<tr height="100%"><td class="first last" style="width: 2000px;"><div id="control--runtime--11231231230" class="control control-caption-horizontal"><style type="text/css">
    .dialog-content{
        display:none;
    }
    table {
        text-align:left;
    }
    .soc-membership-row {
        margin-bottom: 15px;
        border:none;
    }
    .soc-membership-row, .section {
        margin-bottom: 15px;
        border:none;
    }
    .soc-membership-row.control-caption-horizontal .control-set-alignment.control-label-span {
        width: 90%;
    }
    .soc-membership-row table.control-grid > tbody  > tr:nth-child(even){
        background-color:#ecf0f1;
        border: 1px solid #CCCCCC;
    }
    .soc-membership-row table.control-grid > tbody  > tr:nth-child(odd){
        background-color:#f4f6f7;
        border: 1px solid #CCCCCC;
    }
</style>

    <div class="" id="control--runtime--6">
        <table border=1 id="memberTbl">
            <thead>
            <tr class="first table_header">
                <td style="width:5%">No.</td>
                <td style="width:25%">NRIC/FIN/Passport No.</td>
                <td style="width:25%">Name</td>
                <td style="width:25%">Title of Office Bearers</td>
                <td style="width:20%">Action</td>
            </tr>
            </thead>
            <tbody>

            <tr class="empty-row"><td align="center" colspan="5"><b><center><b>No records found</b></center></b></td></tr></tbody>
        </table>
        <div class="" style="position: relative;">
            <input type="button" value="Add Member" id="addMember12" onclick="javascript:addMember11();">
        </div>
    </div></div></td></tr>
<input type="hidden" id="updateKey" name="updateKey">
<input type="hidden" id="updatePosition" name="updatePosition">

<tr height="100%" id="memberParticularDiv" style="display:none;"><td class="first last" style="width: 100%;"><div id="control--runtime--295" class="repeatable-section	control	">
    <div class="control-set-font control-font-header repeatable-section-header">
        <div class="rs-pagination"></div>
        <label>Member's	Particulars<select name="titleMap" id="titleMap"></select></label>
    </div>
    <div id="control--runtime--295--0" class="repeatable-section-item" style="display: block;">
        <div id="control--runtime--10001--0--errorMsg" style="display: none;" class="error_placements"></div>
        <div id="control--runtime--10001--1--errorMsg" style="display: none;" class="error_placements"></div>
        <div id="control--runtime--295--0**errorMsg_section_top" class="error_placements"></div>
        <table class="control-grid">
            <tbody><tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--296--0" class="control	 control-caption-horizontal">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--296--0--label" class="control-label control-set-font control-font-label">
                    Title of Office Bearers :
                </label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <select id="control--runtime--296--0--select" class="control-input control-set-font	control-font-normal">
                    </select>
                    <label id="control--runtime--296--0--view"> </label>
                    <div id="control--runtime--296--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--304--0" class="control  control-caption-horizontal">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--304--0--label" class="control-label control-set-font control-font-label">Citizenship :</label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>

                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <label id="control--runtime--304--0--view"> </label>
                    <table align="left" class="riadoLabel">
                        <tbody><tr>
                            <td width="50%">
                                <div class="control-item-container">
                                    <input type="radio" id="control--runtime--304--0--0" name="control--runtime--304--0" class="control-input" value="1" onclick="javascript:changeCitizenship();">

                                    <span class="required-indicator-before-label"></span><label id="control--runtime--304--0--label--0" for="control--runtime--304--0--0" class="control-label control-set-font control-font-normal">Singapore Citizen</label><span class="required-indicator-after-label"></span>
                                </div>
                                <div class="control-item-aux-container">
                                </div>
                            </td>
                            <td width="50%">
                                <div class="control-item-container">
                                    <input type="radio" id="control--runtime--304--0--1" name="control--runtime--304--0" class="control-input" value="2" onclick="javascript:changeCitizenship();">

                                    <span class="required-indicator-before-label"></span><label id="control--runtime--304--0--label--1" for="control--runtime--304--0--1" class="control-label control-set-font control-font-normal">Singapore Permanent Resident</label><span class="required-indicator-after-label"></span>
                                </div>
                                <div class="control-item-aux-container">
                                </div>
                            </td>

                        </tr>            <tr>
                            <td>
                                <div class="control-item-container">
                                    <input type="radio" id="control--runtime--304--0--2" name="control--runtime--304--0" class="control-input" value="3" onclick="javascript:changeCitizenship();">

                                    <span class="required-indicator-before-label"></span><label id="control--runtime--304--0--label--2" for="control--runtime--304--0--2" class="control-label control-set-font control-font-normal">Others with CorpPass</label><span class="required-indicator-after-label"></span>
                                </div>
                                <div class="control-item-aux-container">
                                </div>
                            </td>
                            <td>
                                <div class="control-item-container">
                                    <input type="radio" id="control--runtime--304--0--3" name="control--runtime--304--0" class="control-input" value="4" onclick="javascript:changeCitizenship('Y');">

                                    <span class="required-indicator-before-label"></span><label id="control--runtime--304--0--label--3" for="control--runtime--304--0--3" class="control-label control-set-font control-font-normal">Others with IROSES Account/Passport Number</label><span class="required-indicator-after-label"></span>
                                </div>
                                <div class="control-item-aux-container">
                                </div>
                            </td>
                        </tr>
                        </tbody></table>
                    <span class="required-indicator-after-input"></span><br/>
                    <div id="control--runtime--304--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--3001--0" class="control  control-caption-horizontal">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--3001--0--label" class="control-label control-set-font control-font-label">Country of Birth :</label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <select id="control--runtime--3001--0--select" class="control-input control-set-font control-font-normal" style="max-width: 850px;width: 90%">
                    </select>
                    <label id="control--runtime--3001--0--view"> </label>
                    <div id="control--runtime--3001--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--906--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--906--0--label" class="control-label control-set-font control-font-label">
                    NRIC :
                </label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <input type="text" maxlength="9" id="control--runtime--906--0--text" class="control-input control-set-font control-font-normal" value="" size="30" autocomplete="off">
                    <label id="control--runtime--906--0--view"> </label>
                    <div id="control--runtime--906--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr><tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--940--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--940--0--label" class="control-label control-set-font control-font-label">
                    FIN :
                </label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <input type="text" maxlength="9" id="control--runtime--940--0--text" class="control-input control-set-font control-font-normal" value="" size="30">
                    <label id="control--runtime--940--0--view"> </label>
                    <div id="control--runtime--940--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr><tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--907--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--907--0--label" class="control-label control-set-font control-font-label">
                    Passport No. :
                </label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <input type="text" maxlength="20" id="control--runtime--907--0--text" class="control-input control-set-font control-font-normal" value="" size="30">
                    <label id="control--runtime--907--0--view"> </label>
                    <div id="control--runtime--907--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr><tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--298--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--298--0--label" class="control-label control-set-font control-font-label">
                    Full Name of Proposed Member :
                </label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <input type="text" maxlength="100" id="control--runtime--298--0--text" class="control-input control-set-font control-font-normal" value="" size="30">
                    <label id="control--runtime--298--0--view"> </label>
                    <div id="control--runtime--298--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--303--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--303--0--label" class="control-label control-set-font control-font-label">
                    Date of Birth :
                </label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <input type="text" id="control--runtime--303--0--text" class=" value="" readonly="readonly"><img class="ui-datepicker-trigger" src="/egp/_themes/egov/images/forms/cal1.png" alt="..." title="...">
                    <label id="control--runtime--303--0--view"> </label>
                    <div id="control--runtime--303--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--935--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--935--0--label" class="control-label control-set-font control-font-label">Nationality :</label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <select id="control--runtime--935--0--select" class="control-input control-set-font control-font-normal">
                    </select>
                    <label id="control--runtime--935--0--view"> </label>
                    <div id="control--runtime--935--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--302--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--302--0--label" class="control-label control-set-font control-font-label">
                    Email Address :
                </label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <input type="text" maxlength="100" id="control--runtime--302--0--text" class="control-input control-set-font control-font-normal" value="" size="30" autocomplete="off">
                    <label id="control--runtime--302--0--view"> </label>
                    <div id="control--runtime--302--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                </div><span class="required-indicator-after-input"></span>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--309--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--309--0--label" class="control-label control-set-font control-font-label">Religion :</label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <select id="control--runtime--309--0--select" class="control-input control-set-font control-font-normal" onclick="javascript:otherReligiontSelect();">
                        <option value="">
                            -Please Select-
                        </option>
                        <option value="Buddhism">Buddhist</option>
                        <option value="Hindu">Hindu</option>
                        <option value="Muslim">Muslim</option>
                        <option value="Christian">Christian</option>
                        <option value="Sikh">Sikh</option>
                        <option value="Taoist">Taoist</option>
                        <option value="Free Thinker">Free Thinker</option>
                        <option value="Others">Others</option>
                    </select>
                    <label id="control--runtime--309--0--view"> </label>
                    <div id="control--runtime--309--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--3002--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <label id="control--runtime--3002--0--label" class="control-label control-set-font control-font-label">
                        Other Religion :
                    </label>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <input type="text" maxlength="20" id="control--runtime--3002--0--text" class="control-input control-set-font control-font-normal" value="" size="30">
                    <label id="control--runtime--3002--0--view"> </label>
                    <div id="control--runtime--3002--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--941--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--941--0--label" class="control-label control-set-font control-font-label">Highest Education Level :</label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <select id="control--runtime--941--0--select" class="control-input control-set-font control-font-normal">
                    </select>
                    <label id="control--runtime--941--0--view"> </label>
                    <div id="control--runtime--941--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--299--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--299--0--label" class="control-label control-set-font control-font-label">Residential Address :</label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>

                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <label id="control--runtime--299--0--view"> </label>
                    <table align="left" class="riadoLabel">
                        <tbody><tr>
                            <td width="50%">
                                <div class="control-item-container">
                                    <input type="radio" id="control--runtime--299--0--0" name="control--runtime--299--0" class="control-input" value="Local Address" onclick="javascript:residentialAddressOption();">

                                    <span class="required-indicator-before-label"></span><label id="control--runtime--299--0--label--0" for="control--runtime--299--0--0" class="control-label control-set-font control-font-normal">Local Address</label><span class="required-indicator-after-label"></span>
                                </div>
                                <div class="control-item-aux-container">
                                </div>
                            </td>
                            <td width="50%">
                                <div class="control-item-container">
                                    <input type="radio" id="control--runtime--299--0--1" name="control--runtime--299--0" class="control-input" value="Foreign Address" onclick="javascript:residentialAddressOption();">

                                    <span class="required-indicator-before-label"></span><label id="control--runtime--299--0--label--1" for="control--runtime--299--0--1" class="control-label control-set-font control-font-normal">Foreign Address</label><span class="required-indicator-after-label"></span>
                                </div>
                                <div class="control-item-aux-container">
                                </div>
                            </td>

                        </tr>
                        </tbody></table>
                    <span class="required-indicator-after-input"></span>
                    <div id="control--runtime--299--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--909--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--909--0--label" class="control-label control-set-font control-font-label">
                    Postal Code :
                </label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <input type="text" maxlength="6" id="control--runtime--909--0--text" class="control-input control-set-font control-font-normal" value="" size="30" autocomplete="off">
                    <label id="control--runtime--909--0--view"> </label>
                    <div id="control--runtime--909--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--910--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--910--0--label" class="control-label control-set-font control-font-label">
                    Building / Block / House No. :
                </label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <select id="control--runtime--910--0--select" class="control-input control-set-font control-font-normal">
                        <option value="">
                            -Please Select-
                        </option>
                    </select>
                    <label id="control--runtime--910--0--view"> </label>
                    <div id="control--runtime--910--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--942--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <label id="control--runtime--942--0--label" class="control-label control-set-font control-font-label">
                        Level : #
                    </label>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <div class="normal-indicator">
                        <input type="text" maxlength="3" id="control--runtime--942--0--text" class="control-input control-set-font control-font-normal" value="" maxlength="3">
                        <label id="control--runtime--942--0--view"> </label>
                        <div id="control--runtime--942--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    </div>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--911--0" class="control un-input control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <label id="control--runtime--911--0--label" class="control-label control-set-font control-font-label">
                        Unit No. :
                    </label>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <div class="normal-indicator">
                        <input type="text" maxlength="5" id="control--runtime--911--0--text" class="control-input control-set-font control-font-normal" value="" size="30">
                        <label id="control--runtime--911--0--view"> </label>
                        <div id="control--runtime--911--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    </div>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--912--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--912--0--label" class="control-label control-set-font control-font-label">
                    Street Name :
                </label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <input type="text" id="control--runtime--912--0--text" class="control-input control-set-font control-font-normal" value="" size="30" disabled="true">
                    <label id="control--runtime--912--0--view"> </label>
                    <div id="control--runtime--912--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--908--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <label id="control--runtime--908--0--label" class="control-label control-set-font control-font-label">
                        Building Name :
                    </label>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <div class="normal-indicator">
                        <input type="text" maxlength="100" id="control--runtime--908--0--text" class="control-input control-set-font control-font-normal" value="" size="30" disabled="true">
                        <label id="control--runtime--908--0--view"> </label>
                        <div id="control--runtime--908--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    </div>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--913--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--913--0--label" class="control-label control-set-font control-font-label">Address :</label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <textarea id="control--runtime--913--0--text" maxlength="1000" onchange="this.value=this.value.substring(0, 1000)" onkeydown="this.value=this.value.substring(0, 1000)" onkeyup="this.value=this.value.substring(0, 1000)" class="control-input control-set-font control-font-normal" rows="3" cols="27"></textarea>
                    <label id="control--runtime--913--0--view"> </label>
                    <div id="control--runtime--913--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <Span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--300--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <label id="control--runtime--300--0--label" class="control-label control-set-font control-font-label">
                        Residential Telephone No. :
                    </label>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <input type="text" maxlength="20" id="control--runtime--300--0--text" class="control-input control-set-font control-font-normal" value="" size="30" autocomplete="off">
                    <label id="control--runtime--300--0--view"> </label>
                    <div id="control--runtime--300--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--301--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--301--0--label" class="control-label control-set-font control-font-label">
                    Mobile No. :
                </label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <input type="text" maxlength="20" id="control--runtime--301--0--text" class="control-input control-set-font control-font-normal" value="" size="30" autocomplete="off">
                    <label id="control--runtime--301--0--view"> </label>
                    <div id="control--runtime--301--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--305--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--305--0--label" class="control-label control-set-font control-font-label">Gender :</label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>

                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <label id="control--runtime--305--0--view"> </label>
                    <table align="left" class="riadoLabel">
                        <tbody><tr>
                            <td width="50%">
                                <div class="control-item-container">
                                    <input type="radio" id="control--runtime--305--0--0" name="control--runtime--305--0" class="control-input" value="Male">

                                    <span class="required-indicator-before-label"></span><label id="control--runtime--305--0--label--0" for="control--runtime--305--0--0" class="control-label control-set-font control-font-normal">Male</label><span class="required-indicator-after-label"></span>
                                </div>
                                <div class="control-item-aux-container">
                                </div>
                            </td>
                            <td width="50%">
                                <div class="control-item-container">
                                    <input type="radio" id="control--runtime--305--0--1" name="control--runtime--305--0" class="control-input" value="Female">

                                    <span class="required-indicator-before-label"></span><label id="control--runtime--305--0--label--1" for="control--runtime--305--0--1" class="control-label control-set-font control-font-normal">Female</label><span class="required-indicator-after-label"></span>
                                </div>
                                <div class="control-item-aux-container">
                                </div>
                            </td>

                        </tr>
                        </tbody></table>
                    <span class="required-indicator-after-input"></span>
                    <div id="control--runtime--305--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--306--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--306--0--label" class="control-label control-set-font control-font-label">Race :</label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <select id="control--runtime--306--0--select" class="control-input control-set-font control-font-normal" onclick="javascript:otherRaceSelect();">
                        <option value="">
                            -Please Select-
                        </option>
                        <option value="Chinese">
                            Chinese
                        </option>
                        <option value="Malay">
                            Malay
                        </option>
                        <option value="Indian">
                            Indian
                        </option>
                        <option value="Others">
                            Others
                        </option>
                    </select>
                    <label id="control--runtime--306--0--view"> </label>
                    <div id="control--runtime--306--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--307--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <label id="control--runtime--307--0--label" class="control-label control-set-font control-font-label">
                        Other Race :
                    </label>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <input type="text" maxlength="20" id="control--runtime--307--0--text" class="control-input control-set-font control-font-normal" value="" size="30">
                    <label id="control--runtime--307--0--view"> </label>
                    <div id="control--runtime--307--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--308--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--308--0--label" class="control-label control-set-font control-font-label">Marital Status :</label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <select id="control--runtime--308--0--select" class="control-input control-set-font control-font-normal">
                        <option value="">
                            -Please Select-
                        </option>
                        <option value="Single">
                            Single
                        </option>
                        <option value="Married">
                            Married
                        </option>
                        <option value="Separated">
                            Separated
                        </option>
                        <option value="Divorced">
                            Divorced
                        </option>
                        <option value="Widowed">
                            Widowed
                        </option>
                    </select>
                    <label id="control--runtime--308--0--view"> </label>
                    <div id="control--runtime--308--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div class="control-set-font control-font-header repeatable-section-header"><label>Present Employment Status</label></div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--916--0" class="control  control-caption-horizontal">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--916--0--label" class="control-label control-set-font control-font-label">Present Employment Status :</label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>

                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <label id="control--runtime--916--0--view"> </label>
                    <table align="left" class="riadoLabel">
                        <tbody><tr>
                            <td width="33.333333333333336%">
                                <div class="control-item-container">
                                    <input type="radio" id="control--runtime--916--0--0" name="control--runtime--916--0" class="control-input" value="1" onclick="javascript:seclectEmploymentStatus();">

                                    <span class="required-indicator-before-label"></span><label id="control--runtime--916--0--label--0" for="control--runtime--916--0--0" class="control-label control-set-font control-font-normal">Unemployed</label><span class="required-indicator-after-label"></span>
                                </div>
                                <div class="control-item-aux-container">
                                </div>
                            </td>
                            <td width="33.333333333333336%">
                                <div class="control-item-container">
                                    <input type="radio" id="control--runtime--916--0--1" name="control--runtime--916--0" class="control-input" value="2" onclick="javascript:seclectEmploymentStatus();">

                                    <span class="required-indicator-before-label"></span><label id="control--runtime--916--0--label--1" for="control--runtime--916--0--1" class="control-label control-set-font control-font-normal">Self-Employed</label><span class="required-indicator-after-label"></span>
                                </div>
                                <div class="control-item-aux-container">
                                </div>
                            </td>
                            <td width="33.333333333333336%">
                                <div class="control-item-container">
                                    <input type="radio" id="control--runtime--916--0--2" name="control--runtime--916--0" class="control-input" value="3" onclick="javascript:seclectEmploymentStatus();">

                                    <span class="required-indicator-before-label"></span><label id="control--runtime--916--0--label--2" for="control--runtime--916--0--2" class="control-label control-set-font control-font-normal">Employed</label><span class="required-indicator-after-label"></span>
                                </div>
                                <div class="control-item-aux-container">
                                </div>
                            </td>

                        </tr>
                        </tbody></table>
                    <span class="required-indicator-after-input"></span>
                    <div id="control--runtime--916--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--918--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--918--0--label" class="control-label control-set-font control-font-label">
                    Name of Employer / Company :
                </label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <input type="text" maxlength="150" id="control--runtime--918--0--text" class="control-input control-set-font control-font-normal" value="" size="30">
                    <label id="control--runtime--918--0--view"> </label>
                    <div id="control--runtime--918--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--917--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--917--0--label" class="control-label control-set-font control-font-label">
                    Position / Job Title :
                </label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <input type="text" maxlength="150" id="control--runtime--917--0--text" class="control-input control-set-font control-font-normal" value="" size="30">
                    <label id="control--runtime--917--0--view"> </label>
                    <div id="control--runtime--917--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--919--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--919--0--label" class="control-label control-set-font control-font-label">Address of Company :</label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>

                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <label id="control--runtime--919--0--view"> </label>
                    <table align="left" class="riadoLabel">
                        <tbody><tr>
                            <td width="50%">
                                <div class="control-item-container">
                                    <input type="radio" id="control--runtime--919--0--0" name="control--runtime--919--0" class="control-input" value="Local Address" onclick="javascript:selectCompanyAddress();">

                                    <span class="required-indicator-before-label"></span><label id="control--runtime--919--0--label--0" for="control--runtime--919--0--0" class="control-label control-set-font control-font-normal">Local Address</label><span class="required-indicator-after-label"></span>
                                </div>
                                <div class="control-item-aux-container">
                                </div>
                            </td>
                            <td width="50%">
                                <div class="control-item-container">
                                    <input type="radio" id="control--runtime--919--0--1" name="control--runtime--919--0" class="control-input" value="Foreign Address" onclick="javascript:selectCompanyAddress();">

                                    <span class="required-indicator-before-label"></span><label id="control--runtime--919--0--label--1" for="control--runtime--919--0--1" class="control-label control-set-font control-font-normal">Foreign Address</label><span class="required-indicator-after-label"></span>
                                </div>
                                <div class="control-item-aux-container">
                                </div>
                            </td>

                        </tr>
                        </tbody></table>
                    <span class="required-indicator-after-input"></span>
                    <div id="control--runtime--919--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--925--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--925--0--label" class="control-label control-set-font control-font-label">
                    Postal Code :
                </label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <input type="text" maxlength="6" id="control--runtime--925--0--text" class="control-input control-set-font control-font-normal" value="" size="30" autocomplete="off">
                    <label id="control--runtime--925--0--view"> </label>
                    <div id="control--runtime--925--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--921--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--921--0--label" class="control-label control-set-font control-font-label">
                    Building / Block / House No. :
                </label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <select id="control--runtime--921--0--select" class="control-input control-set-font control-font-normal">
                        <option value="">
                            -Please Select-
                        </option>
                    </select>
                    <label id="control--runtime--921--0--view"> </label>
                    <div id="control--runtime--921--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--943--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <label id="control--runtime--943--0--label" class="control-label control-set-font control-font-label">
                        Level : #
                    </label>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <div class="normal-indicator">
                        <input type="text" maxlength="3" id="control--runtime--943--0--text" class="control-input control-set-font control-font-normal" value="" size="30">
                        <label id="control--runtime--943--0--view"> </label>
                        <div id="control--runtime--943--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    </div>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--924--0" class="control un-input control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <label id="control--runtime--924--0--label" class="control-label control-set-font control-font-label">
                        Unit No. :
                    </label>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <div class="normal-indicator">
                        <input type="text" maxlength="5" id="control--runtime--924--0--text" class="control-input control-set-font control-font-normal" value="" size="30">
                        <label id="control--runtime--924--0--view"> </label>
                        <div id="control--runtime--924--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    </div>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--922--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--922--0--label" class="control-label control-set-font control-font-label">
                    Street Name :
                </label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <input type="text" id="control--runtime--922--0--text" class="control-input control-set-font control-font-normal" value="" size="30" disabled="true">
                    <label id="control--runtime--922--0--view"> </label>
                    <div id="control--runtime--922--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--923--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <label id="control--runtime--923--0--label" class="control-label control-set-font control-font-label">
                        Building Name :
                    </label>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <div class="normal-indicator">
                        <input type="text" maxlength="100" id="control--runtime--923--0--text" class="control-input control-set-font control-font-normal" value="" size="30" disabled="true">
                        <label id="control--runtime--923--0--view"> </label>
                        <div id="control--runtime--923--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    </div>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--920--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--920--0--label" class="control-label control-set-font control-font-label">
                    Office No.:+65
                </label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <input type="text" maxlength="8" id="control--runtime--920--0--text" class="control-input control-set-font control-font-normal" value="" size="30">
                    <label id="control--runtime--920--0--view"> </label>
                    <div id="control--runtime--920--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>
            <tr height="1"><td class="first last" style="width: 100%;"><div id="control--runtime--926--0" class="control  control-caption-horizontal" style="display: none;">
                <div class="control-label-span control-set-alignment">
                    <span class="required-indicator-before-label"></span><label id="control--runtime--926--0--label" class="control-label control-set-font control-font-label">Address :</label><span class="required-indicator-after-label"></span>
                    <span class="upload_controls"></span>
                </div>
                <div class="control-input-span control-set-alignment">
                    <span class="required-indicator-before-input"></span>
                    <textarea id="control--runtime--926--0--text" maxlength="1000" onchange="this.value=this.value.substring(0, 1000)" onkeydown="this.value=this.value.substring(0, 1000)" onkeyup="this.value=this.value.substring(0, 1000)" class="control-input control-set-font control-font-normal" rows="3" cols="27"></textarea>
                    <label id="control--runtime--926--0--view"> </label>
                    <div id="control--runtime--926--0--errorMsg_right" style="display: none;" class="error_placements"></div>
                    <span class="required-indicator-after-input"></span>
                </div>
            </div></td></tr>



            <tr height="1">
                <td class="first last" style="width:100%;"><div class="soc-membership-row control control-caption-horizontal"><div class="control-set-font control-font-header repeatable-section-header"><label>Present Membership in Other Registered Societies</label></div>
                    <table class="tableColor control-set-font control-font-label">
                        <tbody>
                        <tr class="first table_header">
                            <td>No.</td>
                            <td style="width: 1000px;">Name of Society</td>
                            <td style="width: 1000px;">Position in Society</td>
                        </tr>
                        <tr>
                            <td class="rownum" style="vertical-align:middle;">1</td>
                            <td><div id="control--runtime--948--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--948--0--label"
                                           class="control-label control-set-font control-font-label">Name
                                        of Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" maxlength="300" id="control--runtime--948--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" style="width:350px;">
                                    <label id="control--runtime--948--0--view"> </label>
                                    <div id="control--runtime--948--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                            <td><div id="control--runtime--949--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--949--0--label"
                                           class="control-label control-set-font control-font-label">Position
                                        in Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" maxlength="100" id="control--runtime--949--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" style="width:350px;">
                                    <label id="control--runtime--949--0--view"> </label>
                                    <div id="control--runtime--949--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                        </tr>
                        <tr>
                            <td class="rownum" style="vertical-align:middle;">2</td>
                            <td><div id="control--runtime--950--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--950--0--label"
                                           class="control-label control-set-font control-font-label">Name
                                        of Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--950--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="300" style="width:350px;">
                                    <label id="control--runtime--950--0--view"> </label>
                                    <div id="control--runtime--950--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                            <td><div id="control--runtime--951--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--951--0--label"
                                           class="control-label control-set-font control-font-label">Position
                                        in Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--951--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="100" style="width:350px;">
                                    <label id="control--runtime--951--0--view"> </label>
                                    <div id="control--runtime--951--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                        </tr>
                        <tr>
                            <td class="rownum" style="vertical-align:middle;">3</td>
                            <td><div id="control--runtime--952--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--952--0--label"
                                           class="control-label control-set-font control-font-label">Name
                                        of Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--952--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="300" style="width:350px;">
                                    <label id="control--runtime--952--0--view"> </label>
                                    <div id="control--runtime--952--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                            <td><div id="control--runtime--953--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--953--0--label"
                                           class="control-label control-set-font control-font-label">Position
                                        in Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--953--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="100" style="width:350px;">
                                    <label id="control--runtime--953--0--view"> </label>
                                    <div id="control--runtime--953--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                        </tr>
                        <tr>
                            <td class="rownum" style="vertical-align:middle;">4</td>
                            <td><div id="control--runtime--954--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--954--0--label"
                                           class="control-label control-set-font control-font-label">Name
                                        of Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--954--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="300" style="width:350px;">
                                    <label id="control--runtime--954--0--view"> </label>
                                    <div id="control--runtime--954--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                            <td><div id="control--runtime--955--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--955--0--label"
                                           class="control-label control-set-font control-font-label">Position
                                        in Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--955--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="100" style="width:350px;">
                                    <label id="control--runtime--955--0--view"> </label>
                                    <div id="control--runtime--955--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                        </tr>
                        <tr>
                            <td class="rownum" style="vertical-align:middle;">5</td>
                            <td><div id="control--runtime--956--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--956--0--label"
                                           class="control-label control-set-font control-font-label">Name
                                        of Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--956--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="300" style="width:350px;">
                                    <label id="control--runtime--956--0--view"> </label>
                                    <div id="control--runtime--956--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                            <td><div id="control--runtime--957--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--957--0--label"
                                           class="control-label control-set-font control-font-label">Position
                                        in Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--957--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="100" style="width:350px;">
                                    <label id="control--runtime--957--0--view"> </label>
                                    <div id="control--runtime--957--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                        </tr>
                        <tr>
                            <td class="rownum" style="vertical-align:middle;">6</td>
                            <td><div id="control--runtime--958--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--958--0--label"
                                           class="control-label control-set-font control-font-label">Name
                                        of Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--958--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="300" style="width:350px;">
                                    <label id="control--runtime--958--0--view"> </label>
                                    <div id="control--runtime--958--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                            <td><div id="control--runtime--959--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--959--0--label"
                                           class="control-label control-set-font control-font-label">Position
                                        in Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--959--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="100" style="width:350px;">
                                    <label id="control--runtime--959--0--view"> </label>
                                    <div id="control--runtime--959--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                        </tr>
                        <tr>
                            <td class="rownum" style="vertical-align:middle;">7</td>
                            <td><div id="control--runtime--960--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--960--0--label"
                                           class="control-label control-set-font control-font-label">Name
                                        of Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--960--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="300" style="width:350px;">
                                    <label id="control--runtime--960--0--view"> </label>
                                    <div id="control--runtime--960--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                            <td><div id="control--runtime--961--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--961--0--label"
                                           class="control-label control-set-font control-font-label">Position
                                        in Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--961--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="100" style="width:350px;">
                                    <label id="control--runtime--961--0--view"> </label>
                                    <div id="control--runtime--961--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                        </tr>
                        <tr>
                            <td class="rownum" style="vertical-align:middle;">8</td>
                            <td><div id="control--runtime--962--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--962--0--label"
                                           class="control-label control-set-font control-font-label">Name
                                        of Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--962--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="300" style="width:350px;">
                                    <label id="control--runtime--962--0--view"> </label>
                                    <div id="control--runtime--962--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                            <td><div id="control--runtime--963--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--963--0--label"
                                           class="control-label control-set-font control-font-label">Position
                                        in Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--963--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="100" style="width:350px;">
                                    <label id="control--runtime--963--0--view"> </label>
                                    <div id="control--runtime--963--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                        </tr>
                        <tr>
                            <td class="rownum" style="vertical-align:middle;">9</td>
                            <td><div id="control--runtime--964--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--964--0--label"
                                           class="control-label control-set-font control-font-label">Name
                                        of Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--964--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="300" style="width:350px;">
                                    <label id="control--runtime--964--0--view"> </label>
                                    <div id="control--runtime--964--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                            <td><div id="control--runtime--965--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--965--0--label"
                                           class="control-label control-set-font control-font-label">Position
                                        in Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--965--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="100" style="width:350px;">
                                    <label id="control--runtime--965--0--view"> </label>
                                    <div id="control--runtime--965--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                        </tr>
                        <tr>
                            <td class="rownum" style="vertical-align:middle;">10</td>
                            <td><div id="control--runtime--966--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--966--0--label"
                                           class="control-label control-set-font control-font-label">Name
                                        of Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--966--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="300" style="width:350px;">
                                    <label id="control--runtime--966--0--view"> </label>
                                    <div id="control--runtime--966--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                            <td><div id="control--runtime--967--0" class="control">
                                <div class="control-label-span control-set-alignment" style="display:none;">
                                    <label id="control--runtime--967--0--label"
                                           class="control-label control-set-font control-font-label">Position
                                        in Society</label><span class="upload_controls"></span>
                                </div>
                                <div class="control-input-span control-set-alignment">
                                    <input type="text" id="control--runtime--967--0--text"
                                           class="control-input control-set-font control-font-normal"
                                           value="" size="30" maxlength="100" style="width:350px;">
                                    <label id="control--runtime--967--0--view"> </label>
                                    <div id="control--runtime--967--0--errorMsg_right"
                                         style="display: none;" class="error_placements"></div>
                                </div>
                            </div></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
    </div>
</div></td></tr>
<tr height="100%"><td class="first last" style="width: 100%;"><div id="control--runtime--11212121" class="control  control-caption-horizontal">
    <div class="control-input-span control-set-font control-set-alignment control-button-wrapper">
        <input type="button" id="saveBtn" class="control-input control-set-font control-font-normal" value="Save" onclick="javascript:saveMember();">
        <input type="button" id="updateBtn" class="control-input control-set-font control-font-normal" value="Update" onclick="javascript:updateMember();">
        <span class="upload_controls"></span>
    </div>
</div></td></tr>
<div id="test111"></div>
<input type="hidden" id="firstLoadAjax" name="firstLoadAjax" value="Y">


<script type="text/javascript">
    var sopEngineTabRef = $("input[name='sopEngineTabRef']").val();
    var isFormDB = $('input[name="isFormDB"]').val();

    $(document).ready(function(){
        if ($('#firstLoadAjax').val() == 'Y') {
            $("#titleMap").hide();
            initTitleMap();
            loadAll();
            initalForm();
            $("#control--runtime--303--0--text").datepicker({
                changeMonth: true,
                changeYear: true,
                yearRange: "-99:+0",
                dateFormat: 'dd/mm/yy'
            });

            $("#control--runtime--524").hide();
            $("#control--runtime--525").hide();
            $("#control--printerFriendly--524").hide();
            $("#control--printerFriendly--525").hide();
            $("#control--runtime--528").hide();
            $("#control--printerFriendly--528").hide();
            restWindowHight();
            checkIsChange();
            $('#firstLoadAjax').val('N');
        }
    });

    function initTitleMap() {
        var _success = function(data,status){
            $("#titleMap").empty();
            if (data) {
                $(data).each(function(){
                    $("#titleMap").append('<option value="' + this.value + '">' + this.text + '</option>');
                });
            }
        };

        var _fail = function(data,status){

        };

        var uen = $("#control--runtime--201--text").val();
        $.ajax({
            type: 'POST',
            url: '/egp/iroses/common/ajax.jsp?handler=sg.gov.mha.iroses.registryofsociety.action.RegistryOfSocietyAjax.initTitleMap',
            data: {sopEngineTabRef:sopEngineTabRef, uen:uen},
            success: _success,
            async : false,
            fail:_fail,
            dataType: 'json'
        });
    }


    function conditionAll() {
        changeCitizenship();
    }

    function changeCitizenship(isBtnClick) {
        var citizenship = $('input[name="control--runtime--304--0"]:checked').val();
        if (citizenship == '1' || citizenship=='2') {
            $("#control--runtime--304--0--errorMsg_right").html("");
            $("#control--runtime--304--0--errorMsg_right").attr("style","display: none;");
            $("#control--runtime--906--0").show();
            $('#control--runtime--940--0').hide();
            $('#control--runtime--907--0').hide();
            $("#control--runtime--935--0").hide();
            $("#control--runtime--299--0").hide();
            $('input[name="control--runtime--299--0"]').prop('checked',false);
            $("#control--runtime--306--0").hide();
            $("#control--runtime--306--0--select").val('');
            $("#control--runtime--303--0").show();
            $("#control--runtime--305--0").hide();
            $("#control--runtime--298--0").show();
            $("#control--runtime--302--0").show();
            $("#control--runtime--309--0").show();
            $("#control--runtime--941--0").show();
            $("#control--runtime--300--0").show();
            $("#control--runtime--301--0").show();
            $("#control--runtime--308--0").show();
        } else if (citizenship == '3') {
            $("#control--runtime--304--0--errorMsg_right").html("");
            $("#control--runtime--304--0--errorMsg_right").attr("style","display: block;");
            $("#control--runtime--906--0").hide();
            $('#control--runtime--940--0').show();
            $('#control--runtime--907--0').show();
            $("#control--runtime--935--0").show();
            $("#control--runtime--299--0").show();
            $("#control--runtime--306--0").show();
            $("#control--runtime--303--0").show();
            $("#control--runtime--305--0").show();
            $("#control--runtime--298--0").show();
            $("#control--runtime--302--0").show();
            $("#control--runtime--309--0").show();
            $("#control--runtime--941--0").show();
            $("#control--runtime--300--0").show();
            $("#control--runtime--301--0").show();
            $("#control--runtime--308--0").show();
        } else if (citizenship == '4') {
            $("#control--runtime--304--0--errorMsg_right").html("");
            $("#control--runtime--304--0--errorMsg_right").attr("style","display: none;");
            $("#control--runtime--906--0").hide();
            $('#control--runtime--940--0').hide();
            $('#control--runtime--907--0').show();
            $("#control--runtime--935--0").show();
            $("#control--runtime--299--0").show();
            $("#control--runtime--306--0").show();
            $("#control--runtime--303--0").show();
            $("#control--runtime--305--0").show();
            $("#control--runtime--298--0").show();
            $("#control--runtime--302--0").show();
            $("#control--runtime--309--0").show();
            $("#control--runtime--941--0").show();
            $("#control--runtime--300--0").show();
            $("#control--runtime--301--0").show();
            $("#control--runtime--308--0").show();
        } else {
            $("#control--runtime--304--0--errorMsg_right").html("");
            $("#control--runtime--304--0--errorMsg_right").attr("style","display: none;");
            $("#control--runtime--906--0").hide();
            $('#control--runtime--940--0').hide();
            $('#control--runtime--907--0').hide();
            $("#control--runtime--935--0").hide();
            $("#control--runtime--299--0").hide();
            $('input[name="control--runtime--299--0"]').prop('checked',false);
            $("#control--runtime--306--0").hide();
            $("#control--runtime--306--0--select").val('');
            $("#control--runtime--298--0").hide();
            $("#control--runtime--303--0").hide();
            $("#control--runtime--302--0").hide();
            $("#control--runtime--309--0").hide();
            $("#control--runtime--941--0").hide();
            $("#control--runtime--300--0").hide();
            $("#control--runtime--301--0").hide();
            $("#control--runtime--305--0").hide();
            $("#control--runtime--308--0").hide();
        }
        if (isBtnClick == 'Y') {
            clearDetails();
        }
        residentialAddressOption();
        otherRaceSelect();
        seclectEmploymentStatus();
        restWindowHight();
    }

    function residentialAddressOption(){
        var residentialAddress = $('input[name="control--runtime--299--0"]:checked').val();
        if(residentialAddress == 'Local Address'){
            $("#control--runtime--909--0").show();
            $("#control--runtime--910--0").show();
            $("#control--runtime--942--0").show();
            $("#control--runtime--911--0").show();
            $("#control--runtime--912--0").show();
            $("#control--runtime--908--0").show();
            $("#control--runtime--913--0").hide();
        } else if (residentialAddress == 'Foreign Address'){
            $("#control--runtime--909--0").hide();
            $("#control--runtime--910--0").hide();
            $("#control--runtime--942--0").hide();
            $("#control--runtime--911--0").hide();
            $("#control--runtime--912--0").hide();
            $("#control--runtime--908--0").hide();
            $("#control--runtime--913--0").show();
        } else {
            $("#control--runtime--909--0").hide();
            $("#control--runtime--910--0").hide();
            $("#control--runtime--942--0").hide();
            $("#control--runtime--911--0").hide();
            $("#control--runtime--912--0").hide();
            $("#control--runtime--908--0").hide();
            $("#control--runtime--913--0").hide();
        }
        restWindowHight();
    }

    function otherRaceSelect(){
        var race = $("#control--runtime--306--0--select").val();
        if(race == "Others"){
            $("#control--runtime--307--0").show();
        } else {
            $("#control--runtime--307--0").hide();
        }
        restWindowHight();
    }

    function otherReligiontSelect(){
        var race = $("#control--runtime--309--0--select").val();
        if(race == "Others"){
            $("#control--runtime--3002--0").show();
        } else {
            $("#control--runtime--3002--0").hide();
        }
        restWindowHight();
    }

    function seclectEmploymentStatus(){
        var employmentStatus = $('input[name="control--runtime--916--0"]:checked').val();
        if(employmentStatus == '2' || employmentStatus == '3'){
            $("#control--runtime--918--0").show();
            $("#control--runtime--917--0").show();
            $("#control--runtime--919--0").show();
        } else {
            $("#control--runtime--918--0").hide();
            $("#control--runtime--917--0").hide();
            $("#control--runtime--919--0").hide();
            $('input[name="control--runtime--919--0"]').prop('checked',false);
        }
        selectCompanyAddress();
        restWindowHight();
    }

    function selectCompanyAddress(){
        var companyAddressOption = $('input[name="control--runtime--919--0"]:checked').val();
        if(companyAddressOption == 'Local Address'){
            $("#control--runtime--925--0").show();
            $("#control--runtime--921--0").show();
            $("#control--runtime--943--0").show();
            $("#control--runtime--924--0").show();
            $("#control--runtime--922--0").show();
            $("#control--runtime--923--0").show();
            $("#control--runtime--920--0").show();
            $("#control--runtime--926--0").hide();
        } else if (companyAddressOption == 'Foreign Address'){
            $("#control--runtime--925--0").hide();
            $("#control--runtime--921--0").hide();
            $("#control--runtime--943--0").hide();
            $("#control--runtime--924--0").hide();
            $("#control--runtime--922--0").hide();
            $("#control--runtime--923--0").hide();
            $("#control--runtime--920--0").hide();
            $("#control--runtime--926--0").show();
        } else {
            $("#control--runtime--925--0").hide();
            $("#control--runtime--921--0").hide();
            $("#control--runtime--943--0").hide();
            $("#control--runtime--924--0").hide();
            $("#control--runtime--922--0").hide();
            $("#control--runtime--923--0").hide();
            $("#control--runtime--920--0").hide();
            $("#control--runtime--926--0").hide();
        }
        restWindowHight();
    }
    $("#control--runtime--525--select option").each(function() {
        appendOption(this);
    });

    function appendOption(option) {
        var countrySame = false;
        var countryOfBirth = $("#control--runtime--3001--0--select option");
        var nation = $("#control--runtime--935--0--select option");
        for (var i = 0; i < countryOfBirth.length; i++) {
            if (option.value == countryOfBirth[i].value) {
                countrySame = true;
                break;
            }
        }
        if (!countrySame) {
            if ($(option).text().indexOf("-Please Select-") >= 0) {
                $("#control--runtime--3001--0--select").append('<option value="">' + $(option).text() + '</option>');
            } else {
                $("#control--runtime--3001--0--select").append('<option value="' + $(option).text()+ '">' + $(option).text() + '</option>');
            }
        }
    }

    $("#control--runtime--532--select option").each(function() {
        appendOptionNa(this);
    });

    function appendOptionNa(option) {
        var nationSame = false;
        var nation = $("#control--runtime--935--0--select option");
        for (var i = 0; i < nation.length; i++) {
            if (option.value == nation[i].value) {
                nationSame = true;
                break;
            }
        }
        if (!nationSame) {
            if ($(option).text().indexOf("-Please Select-") >= 0) {
                $("#control--runtime--935--0--select").append('<option value="">' + $(option).text() + '</option>');
            } else {
                $("#control--runtime--935--0--select").append('<option value="' + $(option).text()+ '">' + $(option).text() + '</option>');
            }
        }
    }

    $("#control--runtime--528--select option").each(function() {
        appendOptionHtl(this);
    });

    function appendOptionHtl(option) {
        var htlSame = false;
        var htlOptions = $("#control--runtime--941--0--select option");
        for (var i = 0; i < htlOptions.length; i++) {
            if (option.value == htlOptions[i].value) {
                htlSame = true;
                break;
            }
        }
        if (!htlSame) {
            if ($(option).text().indexOf("-Please Select-") >= 0) {
                $("#control--runtime--941--0--select").append('<option value="">' + $(option).text() + '</option>');
            } else {
                $("#control--runtime--941--0--select").append('<option value="' + $(option).text()+ '">' + $(option).text() + '</option>');
            }
        }
    }

    var index = 1;
    function clearForm() {
        $('#control--runtime--296--0--select').val('');
        $('input[name="control--runtime--304--0"]').prop('checked',false);
        clearDetails();
        conditionAll();
    }

    function clearDetails() {
        $('#control--runtime--906--0--text').val('');
        $('#control--runtime--940--0--text').val('');
        $('#control--runtime--907--0--text').val('');
        $('#control--runtime--298--0--text').val('');
        $("#control--runtime--303--0--text").val('');
        $("#control--runtime--935--0--select").val('');
        $("#control--runtime--302--0--text").val('');
        $("#control--runtime--309--0--select").val('');
        $("#control--runtime--941--0--select").val('');
        $('input[name="control--runtime--299--0"]').prop('checked',false);
        $("#control--runtime--909--0--text").val('');
        $("#control--runtime--910--0--select").val('');
        $("#control--runtime--942--0--text").val('');
        $("#control--runtime--911--0--text").val('');
        $("#control--runtime--912--0--text").val('');
        $("#control--runtime--908--0--text").val('');
        $("#control--runtime--913--0--text").val('');
        $("#control--runtime--300--0--text").val('');
        $("#control--runtime--301--0--text").val('');
        $('input[name="control--runtime--305--0"]').prop('checked',false);
        $("#control--runtime--306--0--select").val('');
        $("#control--runtime--307--0--text").val('');
        $("#control--runtime--308--0--select").val('');
        $('input[name="control--runtime--916--0"]').prop('checked',false);
        $("#control--runtime--918--0--text").val('');
        $("#control--runtime--917--0--text").val('');
        $('input[name="control--runtime--919--0"]').prop('checked',false);
        $("#control--runtime--925--0--text").val('');
        $("#control--runtime--921--0--select").val('');
        $("#control--runtime--943--0--text").val('');
        $("#control--runtime--924--0--text").val('');
        $("#control--runtime--922--0--text").val('');
        $("#control--runtime--923--0--text").val('');
        $("#control--runtime--920--0--text").val('');
        $("#control--runtime--926--0--text").val('');

        $("#control--runtime--948--0--text").val('');
        $("#control--runtime--949--0--text").val('');
        $("#control--runtime--950--0--text").val('');
        $("#control--runtime--951--0--text").val('');
        $("#control--runtime--952--0--text").val('');
        $("#control--runtime--953--0--text").val('');
        $("#control--runtime--954--0--text").val('');
        $("#control--runtime--955--0--text").val('');
        $("#control--runtime--956--0--text").val('');
        $("#control--runtime--957--0--text").val('');
        $("#control--runtime--958--0--text").val('');
        $("#control--runtime--959--0--text").val('');
        $("#control--runtime--960--0--text").val('');
        $("#control--runtime--961--0--text").val('');
        $("#control--runtime--962--0--text").val('');
        $("#control--runtime--963--0--text").val('');
        $("#control--runtime--964--0--text").val('');
        $("#control--runtime--965--0--text").val('');
        $("#control--runtime--966--0--text").val('');
        $("#control--runtime--967--0--text").val('');

        $("#control--runtime--3001--0--select").val('');
        $("#control--runtime--3002--0--text").val('');
    }

    function saveMember(){
        $('.error_placements').hide();
        if (validation() == 0) {
            var titleOfBearers = $('#control--runtime--296--0--select option:selected').val();
            var citizenship = $('input[name="control--runtime--304--0"]:checked').val();
            var nric = $("#control--runtime--906--0--text").val();
            var fin = $("#control--runtime--940--0--text").val();
            var passport = $("#control--runtime--907--0--text").val();
            var name = $("#control--runtime--298--0--text").val();
            var birthDate = $("#control--runtime--303--0--text").val();
            var nationality = $("#control--runtime--935--0--select").val();
            var emailAddress = $("#control--runtime--302--0--text").val();
            var religion = $("#control--runtime--309--0--select").val();
            var highestEducation = $("#control--runtime--941--0--select").val();
            var residentialAddress = $('input[name="control--runtime--299--0"]:checked').val();
            var postalCode = $("#control--runtime--909--0--text").val();
            var addressNo = $("#control--runtime--910--0--select").val();
            var level = $("#control--runtime--942--0--text").val();
            var unit = $("#control--runtime--911--0--text").val();
            var streetName = $("#control--runtime--912--0--text").val();
            var buildingName = $("#control--runtime--908--0--text").val();
            var address = $("#control--runtime--913--0--text").val();
            var residentialTelephone = $("#control--runtime--300--0--text").val();
            var mobilePhone = $("#control--runtime--301--0--text").val();
            var gender = $('input[name="control--runtime--305--0"]:checked').val();
            var race = $("#control--runtime--306--0--select").val();
            var otherRace = $("#control--runtime--307--0--text").val();
            var maritalStatus = $("#control--runtime--308--0--select").val();
            var employmentStatus = $('input[name="control--runtime--916--0"]:checked').val();
            var employerName = $("#control--runtime--918--0--text").val();
            var jobTitle = $("#control--runtime--917--0--text").val();
            var companyAddressOption = $('input[name="control--runtime--919--0"]:checked').val();
            var companyPostalCode = $("#control--runtime--925--0--text").val();
            var companyHouseNo = $("#control--runtime--921--0--select").val();
            var companyLevel = $("#control--runtime--943--0--text").val();
            var companyUnit = $("#control--runtime--924--0--text").val();
            var companyStreetName = $("#control--runtime--922--0--text").val();
            var companyBuildingName = $("#control--runtime--923--0--text").val();
            var officeTel = $("#control--runtime--920--0--text").val();
            var companyAddress = $("#control--runtime--926--0--text").val();

            var shipName0 = $("#control--runtime--948--0--text").val();
            var shipPosition0 = $("#control--runtime--949--0--text").val();
            var shipName1 = $("#control--runtime--950--0--text").val();
            var shipPosition1 = $("#control--runtime--951--0--text").val();
            var shipName2 = $("#control--runtime--952--0--text").val();
            var shipPosition2 = $("#control--runtime--953--0--text").val();
            var shipName3 = $("#control--runtime--954--0--text").val();
            var shipPosition3 = $("#control--runtime--955--0--text").val();
            var shipName4 = $("#control--runtime--956--0--text").val();
            var shipPosition4 = $("#control--runtime--957--0--text").val();
            var shipName5 = $("#control--runtime--958--0--text").val();
            var shipPosition5 = $("#control--runtime--959--0--text").val();
            var shipName6 = $("#control--runtime--960--0--text").val();
            var shipPosition6 = $("#control--runtime--961--0--text").val();
            var shipName7 = $("#control--runtime--962--0--text").val();
            var shipPosition7 = $("#control--runtime--963--0--text").val();
            var shipName8 = $("#control--runtime--964--0--text").val();
            var shipPosition8 = $("#control--runtime--965--0--text").val();
            var shipName9 = $("#control--runtime--966--0--text").val();
            var shipPosition9 = $("#control--runtime--967--0--text").val();

            var coutryBirth = $("#control--runtime--3001--0--select").val();
            var otherReligion = $("#control--runtime--3002--0--text").val();

            $('#memberTbl').find('.empty-row').remove();
            addTableRow(titleOfBearers.split('|')[1], titleOfBearers.split('|')[0], citizenship, nric, fin, passport, name);
            clearForm();
            var data = {
                titleOfBearers : titleOfBearers,
                citizenship : citizenship,
                nric : nric,
                fin : fin,
                passport : passport,
                name : name,
                birthDate : birthDate,
                nationality : nationality,
                emailAddress : emailAddress,
                religion : religion,
                highestEducation : highestEducation,
                residentialAddress : residentialAddress,
                postalCode : postalCode,
                addressNo : addressNo,
                level : level,
                unit : unit,
                streetName : streetName,
                buildingName : buildingName,
                address : address,
                residentialTelephone : residentialTelephone,
                mobilePhone : mobilePhone,
                gender : gender,
                race : race,
                otherRace : otherRace,
                maritalStatus : maritalStatus,
                employmentStatus : employmentStatus,
                employerName : employerName,
                jobTitle : jobTitle,
                companyAddressOption : companyAddressOption,
                companyPostalCode : companyPostalCode,
                companyHouseNo : companyHouseNo,
                companyLevel : companyLevel,
                companyUnit : companyUnit,
                companyStreetName : companyStreetName,
                companyBuildingName : companyBuildingName,
                officeTel : officeTel,
                companyAddress : companyAddress,
                shipName0 : shipName0,
                shipPosition0 : shipPosition0,
                shipName1 : shipName1,
                shipPosition1 : shipPosition1,
                shipName2 : shipName2,
                shipPosition2 : shipPosition2,
                shipName3 : shipName3,
                shipPosition3 : shipPosition3,
                shipName4 : shipName4,
                shipPosition4 : shipPosition4,
                shipName5 : shipName5,
                shipPosition5 : shipPosition5,
                shipName6 : shipName6,
                shipPosition6 : shipPosition6,
                shipName7 : shipName7,
                shipPosition7 : shipPosition7,
                shipName8 : shipName8,
                shipPosition8 : shipPosition8,
                shipName9 : shipName9,
                shipPosition9 : shipPosition9,
                coutryBirth : coutryBirth,
                otherReligion : otherReligion,
                sopEngineTabRef:sopEngineTabRef
            };

            saveToServer(data);
            $('#memberParticularDiv').hide();
            restWindowHight();
            initTitleMap();
            initAllTitleMapDropDown();
        }
    }

    function updateMember(){
        $('.error_placements').hide();
        var updateKey = $('#updateKey').val();
        if (validation(1) == 0) {
            if (updateKey) {
                var titleOfBearers = $('#control--runtime--296--0--select option:selected').text();
                var citizenship = $('input[name="control--runtime--304--0"]:checked').val();
                var nric = $("#control--runtime--906--0--text").val();
                var fin = $("#control--runtime--940--0--text").val();
                var passport = $("#control--runtime--907--0--text").val();
                var name = $("#control--runtime--298--0--text").val();
                var birthDate = $("#control--runtime--303--0--text").val();
                var nationality = $("#control--runtime--935--0--select").val();
                var emailAddress = $("#control--runtime--302--0--text").val();
                var religion = $("#control--runtime--309--0--select").val();
                var highestEducation = $("#control--runtime--941--0--select").val();
                var residentialAddress = $('input[name="control--runtime--299--0"]:checked').val();
                var postalCode = $("#control--runtime--909--0--text").val();
                var addressNo = $("#control--runtime--910--0--select").val();
                var level = $("#control--runtime--942--0--text").val();
                var unit = $("#control--runtime--911--0--text").val();
                var streetName = $("#control--runtime--912--0--text").val();
                var buildingName = $("#control--runtime--908--0--text").val();
                var address = $("#control--runtime--913--0--text").val();
                var residentialTelephone = $("#control--runtime--300--0--text").val();
                var mobilePhone = $("#control--runtime--301--0--text").val();
                var gender = $('input[name="control--runtime--305--0"]:checked').val();
                var race = $("#control--runtime--306--0--select").val();
                var otherRace = $("#control--runtime--307--0--text").val();
                var maritalStatus = $("#control--runtime--308--0--select").val();
                var employmentStatus = $('input[name="control--runtime--916--0"]:checked').val();
                var employerName = $("#control--runtime--918--0--text").val();
                var jobTitle = $("#control--runtime--917--0--text").val();
                var companyAddressOption = $('input[name="control--runtime--919--0"]:checked').val();
                var companyPostalCode = $("#control--runtime--925--0--text").val();
                var companyHouseNo = $("#control--runtime--921--0--select").val();
                var companyLevel = $("#control--runtime--943--0--text").val();
                var companyUnit = $("#control--runtime--924--0--text").val();
                var companyStreetName = $("#control--runtime--922--0--text").val();
                var companyBuildingName = $("#control--runtime--923--0--text").val();
                var officeTel = $("#control--runtime--920--0--text").val();
                var companyAddress = $("#control--runtime--926--0--text").val();

                var shipName0 = $("#control--runtime--948--0--text").val();
                var shipPosition0 = $("#control--runtime--949--0--text").val();
                var shipName1 = $("#control--runtime--950--0--text").val();
                var shipPosition1 = $("#control--runtime--951--0--text").val();
                var shipName2 = $("#control--runtime--952--0--text").val();
                var shipPosition2 = $("#control--runtime--953--0--text").val();
                var shipName3 = $("#control--runtime--954--0--text").val();
                var shipPosition3 = $("#control--runtime--955--0--text").val();
                var shipName4 = $("#control--runtime--956--0--text").val();
                var shipPosition4 = $("#control--runtime--957--0--text").val();
                var shipName5 = $("#control--runtime--958--0--text").val();
                var shipPosition5 = $("#control--runtime--959--0--text").val();
                var shipName6 = $("#control--runtime--960--0--text").val();
                var shipPosition6 = $("#control--runtime--961--0--text").val();
                var shipName7 = $("#control--runtime--962--0--text").val();
                var shipPosition7 = $("#control--runtime--963--0--text").val();
                var shipName8 = $("#control--runtime--964--0--text").val();
                var shipPosition8 = $("#control--runtime--965--0--text").val();
                var shipName9 = $("#control--runtime--966--0--text").val();
                var shipPosition9 = $("#control--runtime--967--0--text").val();

                var coutryBirth = $("#control--runtime--3001--0--select").val();
                var otherReligion = $("#control--runtime--3002--0--text").val();

                $('#memberTbl').find('.empty-row').remove();
                $('#memberParticularDiv').hide();
                restWindowHight();
                var data = {
                    key : updateKey,
                    titleOfBearers : titleOfBearers,
                    citizenship : citizenship,
                    nric : nric,
                    fin : fin,
                    passport : passport,
                    name : name,
                    birthDate : birthDate,
                    nationality : nationality,
                    emailAddress : emailAddress,
                    religion : religion,
                    highestEducation : highestEducation,
                    residentialAddress : residentialAddress,
                    postalCode : postalCode,
                    addressNo : addressNo,
                    level : level,
                    unit : unit,
                    streetName : streetName,
                    buildingName : buildingName,
                    address : address,
                    residentialTelephone : residentialTelephone,
                    mobilePhone : mobilePhone,
                    gender : gender,
                    race : race,
                    otherRace : otherRace,
                    maritalStatus : maritalStatus,
                    employmentStatus : employmentStatus,
                    employerName : employerName,
                    jobTitle : jobTitle,
                    companyAddressOption : companyAddressOption,
                    companyPostalCode : companyPostalCode,
                    companyHouseNo : companyHouseNo,
                    companyLevel : companyLevel,
                    companyUnit : companyUnit,
                    companyStreetName : companyStreetName,
                    companyBuildingName : companyBuildingName,
                    officeTel : officeTel,
                    companyAddress : companyAddress,
                    shipName0 : shipName0,
                    shipPosition0 : shipPosition0,
                    shipName1 : shipName1,
                    shipPosition1 : shipPosition1,
                    shipName2 : shipName2,
                    shipPosition2 : shipPosition2,
                    shipName3 : shipName3,
                    shipPosition3 : shipPosition3,
                    shipName4 : shipName4,
                    shipPosition4 : shipPosition4,
                    shipName5 : shipName5,
                    shipPosition5 : shipPosition5,
                    shipName6 : shipName6,
                    shipPosition6 : shipPosition6,
                    shipName7 : shipName7,
                    shipPosition7 : shipPosition7,
                    shipName8 : shipName8,
                    shipPosition8 : shipPosition8,
                    shipName9 : shipName9,
                    shipPosition9 : shipPosition9,
                    coutryBirth : coutryBirth,
                    otherReligion : otherReligion,
                    sopEngineTabRef:sopEngineTabRef
                };
                updateToServer(data);
                clearForm();
                loadAll();
            } else {
                SOP.Common.alert("Can't Update.");
            }
        }
    }

    var flag = 0;

    function editSociety(e, paramKey) {
        clearForm();
        var key = '';
        var position = '';
        if (e && e !='') {
            key = $(e).parent().parent().find('input[name="memberKey"]').val();
            position = $(e).parent().parent().find('input[name="equivalentPostHide"]').val();

        } else {
            key = paramKey;
        }
        $('#updateKey').val(key);
        $('#updatePosition').val(position);
        var _success = function(data,status){
            loadingOne(data);
        };

        var _fail = function(data,status){

        };

        $.ajax({
            type: 'POST',
            url: '/egp/iroses/common/ajax.jsp?handler=sg.gov.mha.iroses.registryofsociety.action.RegistryOfSocietyAjax.loadIndivalMember',
            data: {key:key, sopEngineTabRef:sopEngineTabRef},
            success: _success,
            async : false,
            fail:_fail,
            dataType: 'json'
        });
    }

    function loadingOne(data){
        var sampleMark = '******';
        var newFlag = data.newFlag;
        var titleOfBearers = data.titleOfBearers;
        var equivalentPost  = data.equivalentPost;
        var citizenship = data.citizenship;
        var nric = data.nric;
        var fin = data.fin;
        var passport = data.passport;
        var name = data.name;
        var birthDate = sampleMark;
        var nationality = sampleMark;
        var emailAddress = sampleMark;
        var religion = sampleMark;
        var highestEducation = sampleMark;
        var residentialAddress = sampleMark;
        var postalCode = sampleMark;
        var addressNo = sampleMark;
        var level = sampleMark;
        var unit = sampleMark;
        var streetName = sampleMark;
        var buildingName = sampleMark;
        var address = sampleMark;
        var residentialTelephone = sampleMark;
        var mobilePhone = sampleMark;
        var gender = sampleMark;
        var race = sampleMark;
        var otherRace = sampleMark;
        var maritalStatus = sampleMark;
        var employmentStatus = sampleMark;
        var employerName = sampleMark;
        var jobTitle = sampleMark;

        var companyAddressOption = sampleMark;
        var companyPostalCode = sampleMark;
        var companyHouseNo = sampleMark;
        var companyLevel = sampleMark;
        var companyUnit = sampleMark;
        var companyStreetName = sampleMark;
        var companyBuildingName = sampleMark;
        var officeTel = sampleMark;
        var companyAddress = sampleMark;
        var shipName0 = sampleMark;
        var shipPosition0 = sampleMark;
        var shipName1 = sampleMark;
        var shipPosition1 = sampleMark;
        var shipName2 = sampleMark;
        var shipPosition2 = sampleMark;
        var shipName3 = sampleMark;
        var shipPosition3 = sampleMark;
        var shipName4 = sampleMark;
        var shipPosition4 = sampleMark;
        var shipName5 = sampleMark;
        var shipPosition5 = sampleMark;
        var shipName6 = sampleMark;
        var shipPosition6 = sampleMark;
        var shipName7 = sampleMark;
        var shipPosition7 = sampleMark;
        var shipName8 = sampleMark;
        var shipPosition8 = sampleMark;
        var shipName9 = sampleMark;
        var shipPosition9 = sampleMark;
        var coutryBirth = sampleMark;
        var otherReligion = sampleMark;
        if (newFlag && 'Y'==newFlag) {
            titleOfBearers = data.titleOfBearers;
            equivalentPost  = data.equivalentPost;
            citizenship = data.citizenship;
            nric = data.nric;
            fin = data.fin;
            passport = data.passport;
            name = data.name;
            birthDate = data.birthDate;
            nationality = data.nationality;
            emailAddress = data.emailAddress;
            religion = data.religion;
            highestEducation = data.highestEducation;
            residentialAddress = data.residentialAddress;
            postalCode = data.postalCode;
            addressNo = data.addressNo;
            level = data.level;
            unit = data.unit;
            streetName = data.streetName;
            buildingName = data.buildingName;
            address = data.address;
            residentialTelephone = data.residentialTelephone;
            mobilePhone = data.mobilePhone;
            gender = data.gender;
            race = data.race;
            otherRace = data.otherRace;
            maritalStatus = data.maritalStatus;
            employmentStatus = data.employmentStatus;
            employerName = data.employerName;
            jobTitle = data.jobTitle;
            companyAddressOption = data.companyAddressOption;
            companyPostalCode = data.companyPostalCode;
            companyHouseNo = data.companyHouseNo;
            companyLevel = data.companyLevel;
            companyUnit = data.companyUnit;
            companyStreetName = data.companyStreetName;
            companyBuildingName = data.companyBuildingName;
            officeTel = data.officeTel;
            companyAddress = data.companyAddress;

            shipName0 = data.shipName0;
            shipPosition0 = data.shipPosition0;
            shipName1 = data.shipName1;
            shipPosition1 = data.shipPosition1;
            shipName2 = data.shipName2;
            shipPosition2 = data.shipPosition2;
            shipName3 = data.shipName3;
            shipPosition3 = data.shipPosition3;
            shipName4 = data.shipName4;
            shipPosition4 = data.shipPosition4;
            shipName5 = data.shipName5;
            shipPosition5 = data.shipPosition5;
            shipName6 = data.shipName6;
            shipPosition6 = data.shipPosition6;
            shipName7 = data.shipName7;
            shipPosition7 = data.shipPosition7;
            shipName8 = data.shipName8;
            shipPosition8 = data.shipPosition8;
            shipName9 = data.shipName9;
            shipPosition9 = data.shipPosition9;

            coutryBirth = data.coutryBirth;
            otherReligion = data.otherReligion;
        }

        $('#memberParticularDiv').show();
        $("#updateBtn").show();
        $("#saveBtn").hide();
        $('#control--runtime--296--0--select').val(titleOfBearers.replace(/(^\s*)|(\s*$)/g, ''));
        $('input[name="control--runtime--304--0"][value="'+citizenship+'"]').prop('checked',"checked");
        $('#control--runtime--906--0--text').val(nric);
        $('#control--runtime--940--0--text').val(fin);
        $('#control--runtime--907--0--text').val(passport);
        $('#control--runtime--298--0--text').val(name);
        $("#control--runtime--303--0--text").val(birthDate);
        $("#control--runtime--935--0--select").val(nationality);
        $("#control--runtime--302--0--text").val(emailAddress);
        $("#control--runtime--309--0--select").val(religion);
        $("#control--runtime--941--0--select").val(highestEducation);
        $('input[name="control--runtime--299--0"][value="'+residentialAddress+'"]').prop('checked',"checked");
        $("#control--runtime--909--0--text").val(postalCode);
        initBlockNodropdown(postalCode,"control--runtime--910--0--select");
        $("#control--runtime--910--0--select").val(addressNo);
        $("#control--runtime--942--0--text").val(level);
        $("#control--runtime--911--0--text").val(unit);
        $("#control--runtime--912--0--text").val(streetName);
        $("#control--runtime--908--0--text").val(buildingName);
        $("#control--runtime--913--0--text").val(address);
        $("#control--runtime--300--0--text").val(residentialTelephone);
        $("#control--runtime--301--0--text").val(mobilePhone);
        $('input[name="control--runtime--305--0"][value="'+gender+'"]').prop('checked',"checked");
        $("#control--runtime--306--0--select").val(race);
        $("#control--runtime--307--0--text").val(otherRace);
        $("#control--runtime--308--0--select").val(maritalStatus);
        $('input[name="control--runtime--916--0"][value="'+employmentStatus+'"]').prop('checked',"checked");
        $("#control--runtime--918--0--text").val(employerName);
        $("#control--runtime--917--0--text").val(jobTitle);
        $('input[name="control--runtime--919--0"][value="'+companyAddressOption+'"]').prop('checked',"checked");
        $("#control--runtime--925--0--text").val(companyPostalCode);
        initBlockNodropdown(companyPostalCode,"control--runtime--921--0--select");
        $("#control--runtime--921--0--select").val(companyHouseNo);
        $("#control--runtime--943--0--text").val(companyLevel);
        $("#control--runtime--924--0--text").val(companyUnit);
        $("#control--runtime--922--0--text").val(companyStreetName);
        $("#control--runtime--923--0--text").val(companyBuildingName);
        $("#control--runtime--920--0--text").val(officeTel);
        $("#control--runtime--926--0--text").val(companyAddress);

        $("#control--runtime--948--0--text").val(shipName0);
        $("#control--runtime--949--0--text").val(shipPosition0);
        $("#control--runtime--950--0--text").val(shipName1);
        $("#control--runtime--951--0--text").val(shipPosition1);
        $("#control--runtime--952--0--text").val(shipName2);
        $("#control--runtime--953--0--text").val(shipPosition2);
        $("#control--runtime--954--0--text").val(shipName3);
        $("#control--runtime--955--0--text").val(shipPosition3);
        $("#control--runtime--956--0--text").val(shipName4);
        $("#control--runtime--957--0--text").val(shipPosition4);
        $("#control--runtime--958--0--text").val(shipName5);
        $("#control--runtime--959--0--text").val(shipPosition5);
        $("#control--runtime--960--0--text").val(shipName6);
        $("#control--runtime--961--0--text").val(shipPosition6);
        $("#control--runtime--962--0--text").val(shipName7);
        $("#control--runtime--963--0--text").val(shipPosition7);
        $("#control--runtime--964--0--text").val(shipName8);
        $("#control--runtime--965--0--text").val(shipPosition8);
        $("#control--runtime--966--0--text").val(shipName9);
        $("#control--runtime--967--0--text").val(shipPosition9);

        $("#control--runtime--3001--0--select").val(coutryBirth);
        $("#control--runtime--3002--0--text").val(otherReligion);

        $('#control--runtime--296--0--view').html(titleOfBearers);
        $('#control--runtime--297--0--view').html(equivalentPost);
        if ('Y'!=newFlag) {
            $('#control--runtime--304--0--view').html(sampleMark);
        } else {
            if (citizenship=='1')
            {
                $('#control--runtime--304--0--view').html('Singapore Citizen');
            } else if (citizenship=='2')
            {
                $('#control--runtime--304--0--view').html('Singapore Permanent Resident');
            } else if (citizenship=='3')
            {
                $('#control--runtime--304--0--view').html('Others with CorpPass');
            } else if (citizenship=='4')
            {
                $('#control--runtime--304--0--view').html('Others with IROSES Account/Passport Number');
            }
        }
        $('#control--runtime--906--0--view').html(formatMasked(nric));
        $('#control--runtime--940--0--view').html(formatMasked(fin));
        $('#control--runtime--907--0--view').html(formatMasked(passport));
        $('#control--runtime--298--0--view').html(escapHtml(name));
        $("#control--runtime--303--0--view").html(birthDate);
        $("#control--runtime--935--0--view").html(nationality);
        $("#control--runtime--302--0--view").html(emailAddress);
        $("#control--runtime--309--0--view").html(religion);
        $("#control--runtime--941--0--view").html(highestEducation);
        $('#control--runtime--299--0--view').html(residentialAddress);
        $("#control--runtime--909--0--view").html(postalCode);
        $("#control--runtime--910--0--view").html(addressNo);
        $("#control--runtime--942--0--view").html(level);
        $("#control--runtime--911--0--view").html(unit);
        $("#control--runtime--912--0--view").html(streetName);
        $("#control--runtime--908--0--view").html(buildingName);
        $("#control--runtime--913--0--view").html(escapHtml(address));
        $("#control--runtime--300--0--view").html(residentialTelephone);
        $("#control--runtime--301--0--view").html(mobilePhone);
        $("#control--runtime--305--0--view").html(gender);
        $("#control--runtime--306--0--view").html(race);
        $("#control--runtime--307--0--view").html(otherRace);
        $("#control--runtime--308--0--view").html(maritalStatus);
        if (employmentStatus=='1')
        {
            $('#control--runtime--916--0--view').html('Unemployed');
        } else if (employmentStatus=='2')
        {
            $('#control--runtime--916--0--view').html('Self-Employed');
        } else if (employmentStatus=='3')
        {
            $('#control--runtime--916--0--view').html('Employed');
        } else if (employmentStatus==sampleMark) {
            $('#control--runtime--916--0--view').html(sampleMark);
        }
        $("#control--runtime--918--0--view").html(escapHtml(employerName));
        $("#control--runtime--917--0--view").html(escapHtml(jobTitle));
        $('#control--runtime--919--0--view').html(companyAddressOption);
        $("#control--runtime--925--0--view").html(companyPostalCode);
        $("#control--runtime--921--0--view").html(companyHouseNo);
        $("#control--runtime--943--0--view").html(companyLevel);
        $("#control--runtime--924--0--view").html(companyUnit);
        $("#control--runtime--922--0--view").html(companyStreetName);
        $("#control--runtime--923--0--view").html(companyBuildingName);
        $("#control--runtime--920--0--view").html(officeTel);
        $("#control--runtime--926--0--view").html(escapHtml(companyAddress));

        $("#control--runtime--948--0--view").html(shipName0);
        $("#control--runtime--949--0--view").html(shipPosition0);
        $("#control--runtime--950--0--view").html(shipName1);
        $("#control--runtime--951--0--view").html(shipPosition1);
        $("#control--runtime--952--0--view").html(shipName2);
        $("#control--runtime--953--0--view").html(shipPosition2);
        $("#control--runtime--954--0--view").html(shipName3);
        $("#control--runtime--955--0--view").html(shipPosition3);
        $("#control--runtime--956--0--view").html(shipName4);
        $("#control--runtime--957--0--view").html(shipPosition4);
        $("#control--runtime--958--0--view").html(shipName5);
        $("#control--runtime--959--0--view").html(shipPosition5);
        $("#control--runtime--960--0--view").html(shipName6);
        $("#control--runtime--961--0--view").html(shipPosition6);
        $("#control--runtime--962--0--view").html(shipName7);
        $("#control--runtime--963--0--view").html(shipPosition7);
        $("#control--runtime--964--0--view").html(shipName8);
        $("#control--runtime--965--0--view").html(shipPosition8);
        $("#control--runtime--966--0--view").html(shipName9);
        $("#control--runtime--967--0--view").html(shipPosition9);

        $("#control--runtime--3001--0--view").html(coutryBirth);
        $("#control--runtime--3002--0--view").html(otherReligion);


        conditionAll();
        initalForm();
        flag = 1;
    };
    function initBlockNodropdown(value,selectId){
        $.ajax({
            url: '/egp/iroses/common/ajax.jsp?handler=sg.gov.mha.iroses.registryofsociety.action.RegistryOfSocietyAjax.retrievePostalCodeMessage',
            type: 'POST',
            async: false,
            data: {
                postalCode : value
            },
            dataType: 'JSON',
            success: function(data) {
                if(data.errorMessage != null && data.errorMessage != ""){
                    $("#"+selectId).empty();
                    $("#"+selectId).append( "<option value=\"\">-Please Select-</option>" );
                    $("#"+selectId).append('<option value="">N/A</option>');
                }else{
                    $("#"+selectId).empty();
                    $("#"+selectId).append( "<option value=\"\">-Please Select-</option>" );
                    var blkHouseNos = data.blkHouseNos;
                    for(var i=0;i<blkHouseNos.length;i++){
                        $("#"+selectId).append('<option value="' + blkHouseNos[i]+ '">' + blkHouseNos[i] + '</option>');
                    }
                }
            }
        });
    }


    function restWindowHight() {
        var timerId;
        (timerId && clearTimeout(timerId));
        timerId = setTimeout(function(){
            if (window !== window.parent && window.parent && window.parent.EGP && window.parent.EGP.Common){
                window.parent.EGP.Common.onFrameDocumentChange($("html").height());
                window.parent.EGP.Common.onFrameDocumentChange(document.documentElement.scrollHeight);
            }
        }, 1);
    }

    function initalForm() {
        if (Form.isView) {
            $("select").hide();
            $('input[type="text"]').hide();
            $("label[id$='--view']").show();
            $(".riadoLabel").hide();
            $(".editBtn").val("View");
            $(".deleteBtn").hide();
            $("#updateBtn").hide();
            $("#saveBtn").hide();
            $("#addMember12").hide();
            $(".required-indicator-before-input").hide();
            $(".ui-datepicker-trigger").hide();
            $("textarea").hide();
        } else {
            $("label[id$='--view']").hide();
        }
        if (Form.isView && Form.currentMode=='runtime') {
            $("select[name='titleEvqMapSelect']").each(function(){
                $(this).show();
                $(this).attr("disabled","disabled");
            });
        }
    }

    function addMember11(){
        clearForm();
        $('#memberParticularDiv').toggle();
        $("#updateBtn").hide();
        $("#saveBtn").show();
        restWindowHight();
        var optionsLength = $("#control--runtime--296--0--select option").length;
        if (optionsLength <= 0) {
            $('#control--runtime--296--0--errorMsg_right').html("You have reached the maximum number of posts. Please refer to the society's constitution.");
            $("#control--runtime--296--0--errorMsg_right").attr("style","display: block;");
        } else {
            $('#control--runtime--296--0--errorMsg_right').html('');
            $("#control--runtime--296--0--errorMsg_right").removeAttr("style","display: block;");
        }
    }

    function generateKey(citizenship, nric, fin, passport) {
        var key = '';
        if (citizenship == '1' || citizenship == '2'){
            key = citizenship + "||" + nric;
        } else if (citizenship == '3'){
            key = citizenship + "||" + fin + "||" + passport;
        } else {
            key = citizenship + "||" + passport;
        }
        return key;
    }
    var globalViewHtml = '';

    function loadAll() {
        var appNo = $("input[name='appNo']").val();
        var _success = function(data,status){
            $('#memberTbl').find('tbody').find('tr').remove();
            initRowIndex();
            if (data) {
                $(data).each(function(){
                    var titleOfBearers = this.titleOfBearers;
                    var equivalentPost  = this.equivalentPost;
                    var citizenship = this.citizenship;
                    var nric = this.nric;
                    var fin = this.fin;
                    var passport = this.passport;
                    var name = this.name;
                    addTableRow(titleOfBearers, equivalentPost, citizenship, nric, fin, passport, name);
                    if (Form.isView && Form.currentMode=='printerFriendly') {
                        var key = generateKey(citizenship, nric, fin, passport);
                        //editSociety('', key);
                        loadingOne(this);
                        var localFlag = 0;
                        while (localFlag<1)
                        {
                            if (flag == 1) {
                                var viewHtml = ('<tr height="100%" id="memberParticularDiv1" style="">'+$("#memberParticularDiv").html()+'</tr><br/><br/><br/>');
                                globalViewHtml = globalViewHtml + viewHtml;
                                localFlag = 1;
                                flag = 0;
                            }
                        }
                    }

                });
            }
            initalForm();
            if (Form.isView && Form.currentMode=='printerFriendly') {
                $("#memberTbl").hide();
                $('#memberParticularDiv').remove();
                $("#control--printerFriendly--526").html('<table>'+globalViewHtml+'</tabel>');
                $("label[id$='--view']").each(function(){
                    $(this).addClass("control-input control-set-font control-font-normal");
                    $(this).wrap("<div class='normal-indicator'></div>");
                });
                $("label[id$='--view']").each(function(){
                    if ($(this).html().replace(/^\s\s*/, '' ).replace(/\s\s*$/, '' ) == '') {
                        $(this).html('N/A');
                    }

                });
            } else if (Form.isView && Form.currentMode=='runtime') {
                $(".editBtn").hide();
                $("select[name='titleEvqMapSelect']").each(function(){
                    $(this).show();
                });
            }
            restWindowHight();
            initAllTitleMapDropDown();
        };

        var _fail = function(data,status){

        };
        $.ajax({
            type: 'POST',
            url: '/egp/iroses/common/ajax.jsp?handler=sg.gov.mha.iroses.registryofsociety.action.RegistryOfSocietyAjax.loadAllAction',
            data: {sopEngineTabRef:sopEngineTabRef,appNo:appNo,mode:Form.currentMode,isView:Form.isView,isFromDb:isFormDB},
            success: _success,
            fail:_fail,
            async: false,
            dataType: 'json'
        });
    }

    function formatMasked(masked) {
        if (masked == undefined || masked == '') {
            return '';
        }

        var result = '';
        if (masked.length > 1) {
            result = masked.substring(0,1)+'***'
        }

        if (masked.length > 4) {
            result = result + masked.substring(4);
        }
        return result;
    }

    function addTableRow(titleOfBearers, equivalentPost, citizenship, nric, fin, passport, name){
        var trs = $('#memberTbl').find('tbody').find('tr.empty-row');
        if(trs.length > 0){
            trs.remove();
        }

        var $tr = $('<tr></tr>');
        $tr.append('<td sylte="width:5%" class="rosrownum">'+index+'</td>');
        if (citizenship == '1' || citizenship=='2') {
            $tr.append('<td sylte="width:25%">'+formatMasked(nric)+'</td>');
        } else if (citizenship == '3') {
            $tr.append('<td sylte="width:25%">'+formatMasked(fin)+'</td>');
        } else if (citizenship == '4') {
            $tr.append('<td sylte="width:25%">'+formatMasked(passport)+'</td>');
        }
        $tr.append('<td sylte="width:25%">'+escapHtml(name)+'<input type="hidden" name="equivalentPostHide" value="' + equivalentPost + '"/></td>');
        $tr.append('<td sylte="width:25%" >'+'<select name="titleEvqMapSelect" style="width:149px;" onchange="javascript:updateTitle(this);"><option selected="selected" value="'+equivalentPost+'|'+titleOfBearers+'">'+titleOfBearers+'</option></select>'+'<input type="hidden" name="memberKey" value="' + generateKey(citizenship, nric, fin, passport) + '"/></td>');

        $tr.append('<td sylte="width:20%"><input type="button" class="deleteBtn" value="Delete" onclick="removeCurrentRow(this);"/></td>');
        $('#memberTbl').append($tr);
        initRowIndex();
    }

    function initAllTitleMapDropDown() {
        $("select[name='titleEvqMapSelect']").each(function() {
            var option = $(this).find('option:selected');
            $(this).empty();
            $(this).append(option);
        });
        $("#control--runtime--296--0--select").empty();
        $("#titleMap option").each(function() {
            appendOptionTitleMaps(this);
        });
    }

    function appendOptionTitleMaps(option) {
        $("select[name='titleEvqMapSelect']").each(function() {
            var htlSame = false;
            var htlOptions =  $(this).find('option');
            for (var i = 0; i < htlOptions.length; i++) {
                if (option.value == htlOptions[i].value) {
                    htlSame = true;
                    break;
                }
            }
            if (!htlSame) {
                $(this).append('<option value="'+$(option).val()+'">' + $(option).text() + '</option>');
            }
        });
        $("#control--runtime--296--0--select").append('<option value="'+$(option).val()+'">' + $(option).text() + '</option>');
    }

    function updateTitle(e) {
        var key = $(e).parent().parent().find('input[name="memberKey"]').val();
        var title = $(e).val();
        var _success = function(data,status){
            $(e).parent().parent().find('input[name="equivalentPostHide"]').val(title.split('|')[0]);
            initTitleMap();
            initAllTitleMapDropDown();
        };

        var _fail = function(data,status){

        };
        $.ajax({
            type: 'POST',
            url: '/egp/iroses/common/ajax.jsp?handler=sg.gov.mha.iroses.annualreturns.action.AnnualReturnsAjax.updateTitle',
            data: {key:key, sopEngineTabRef:sopEngineTabRef, titleEqvPost:title},
            success: _success,
            fail:_fail,
            async: false,
            dataType: 'json'
        });
    }

    function removeCurrentRow(e){
        SOP.Common.confirm({message:'Are you sure you want to delete this row?',func:function(){
                var key = $(e).parent().parent().find('input[name="memberKey"]').val();
                $(e).parent().parent().remove();
                initRowIndex();
                removeFromServer(key);
                initTitleMap();
                initAllTitleMapDropDown();
                var optionsLength = $("#control--runtime--296--0--select option").length;
                if (optionsLength <= 0) {
                    $('#control--runtime--296--0--errorMsg_right').html("You have reached the maximum number of posts. Please refer to the society's constitution.");
                    $("#control--runtime--296--0--errorMsg_right").attr("style","display: block;");
                } else {
                    $('#control--runtime--296--0--errorMsg_right').html('');
                    $("#control--runtime--296--0--errorMsg_right").removeAttr("style","display: block;");
                }
            }});
    }

    function initRowIndex(){
        var trs = $('#memberTbl').find('tbody').find('tr:not(.empty-row)');
        if(trs.length==0){
            $('#memberTbl').append('<tr class="empty-row"><td align="center" colspan="7"><b><center><b>No records found</b></center></b></td></tr>');
        }else{
            trs.each(function(i){
                $(this).find('td:first').html(i+1);
            });
        }
    }

    function removeFromServer(key){
        var _success = function(data,status){

        };

        var _fail = function(data,status){

        };

        $.ajax({
            type: 'POST',
            url: '/egp/iroses/common/ajax.jsp?handler=sg.gov.mha.iroses.registryofsociety.action.RegistryOfSocietyAjax.remvoeParticular',
            data: {key:key, sopEngineTabRef:sopEngineTabRef},
            success: _success,
            fail:_fail,
            async: false,
            dataType: 'json'
        });
    }

    function saveToServer(data){
        var _success = function(data,status){

        };

        var _fail = function(data,status){

        };

        $.ajax({
            type: 'POST',
            url: '/egp/iroses/common/ajax.jsp?handler=sg.gov.mha.iroses.annualreturns.action.AnnualReturnsAjax.saveParticular',
            data: data,
            success: _success,
            fail:_fail,
            async: false,
            dataType: 'json'
        });
    }

    function updateToServer(data){
        var _success = function(data,status){

        };

        var _fail = function(data,status){

        };

        $.ajax({
            type: 'POST',
            url: '/egp/iroses/common/ajax.jsp?handler=sg.gov.mha.iroses.registryofsociety.action.RegistryOfSocietyAjax.updateParticular',
            data: data,
            success: _success,
            fail:_fail,
            dataType: 'json'
        });
    }

    function validation(updateFlag) {
        var errorCount = 0;
        var titleOfBearers = $('#control--runtime--296--0--select option:selected').val();
        var citizenship = $('input[name="control--runtime--304--0"]:checked').val();
        var nric = $("#control--runtime--906--0--text").val();
        var fin = $("#control--runtime--940--0--text").val();
        var passport = $("#control--runtime--907--0--text").val();
        var name = $("#control--runtime--298--0--text").val();
        var birthDate = $("#control--runtime--303--0--text").val();
        var nationality = $("#control--runtime--935--0--select").val();
        var emailAddress = $("#control--runtime--302--0--text").val();
        var religion = $("#control--runtime--309--0--select").val();
        var highestEducation = $("#control--runtime--941--0--select").val();
        var residentialAddress = $('input[name="control--runtime--299--0"]:checked').val();
        var postalCode = $("#control--runtime--909--0--text").val();
        var addressNo = $("#control--runtime--910--0--select").val();
        var level = $("#control--runtime--942--0--text").val();
        var unit = $("#control--runtime--911--0--text").val();
        var streetName = $("#control--runtime--912--0--text").val();
        var buildingName = $("#control--runtime--908--0--text").val();
        var address = $("#control--runtime--913--0--text").val();
        var residentialTelephone = $("#control--runtime--300--0--text").val();
        var mobilePhone = $("#control--runtime--301--0--text").val();
        var gender = $('input[name="control--runtime--305--0"]:checked').val();
        var race = $("#control--runtime--306--0--select").val();
        var otherRace = $("#control--runtime--307--0--text").val();
        var maritalStatus = $("#control--runtime--308--0--select").val();
        var employmentStatus = $('input[name="control--runtime--916--0"]:checked').val();
        var employerName = $("#control--runtime--918--0--text").val();
        var jobTitle = $("#control--runtime--917--0--text").val();
        var companyAddressOption = $('input[name="control--runtime--919--0"]:checked').val();
        var companyPostalCode = $("#control--runtime--925--0--text").val();
        var companyHouseNo = $("#control--runtime--921--0--select").val();
        var companyLevel = $("#control--runtime--943--0--text").val();
        var companyUnit = $("#control--runtime--924--0--text").val();
        var companyStreetName = $("#control--runtime--922--0--text").val();
        var companyBuildingName = $("#control--runtime--923--0--text").val();
        var officeTel = $("#control--runtime--920--0--text").val();
        var companyAddress = $("#control--runtime--926--0--text").val();

        var coutryBirth = $("#control--runtime--3001--0--select").val();
        var otherReligion = $("#control--runtime--3002--0--text").val();

        var updateKey = $('#updateKey').val();
        var updatePosition=$('#updatePosition').val();
        var memberkey = generateKey(citizenship, nric, fin, passport);

        var nameOfSoc1=$('#control--runtime--948--0--text').val();
        var positionInSoc1=$('#control--runtime--949--0--text').val();

        var nameOfSoc2=$('#control--runtime--950--0--text').val();
        var positionInSoc2=$('#control--runtime--951--0--text').val();

        var nameOfSoc3=$('#control--runtime--952--0--text').val();
        var positionInSoc3=$('#control--runtime--953--0--text').val();

        var nameOfSoc4=$('#control--runtime--954--0--text').val();
        var positionInSoc4=$('#control--runtime--955--0--text').val();

        var nameOfSoc5=$('#control--runtime--956--0--text').val();
        var positionInSoc5=$('#control--runtime--957--0--text').val();

        var nameOfSoc6=$('#control--runtime--958--0--text').val();
        var positionInSoc6=$('#control--runtime--959--0--text').val();

        var nameOfSoc7=$('#control--runtime--960--0--text').val();
        var positionInSoc7=$('#control--runtime--961--0--text').val();

        var nameOfSoc8=$('#control--runtime--962--0--text').val();
        var positionInSoc8=$('#control--runtime--963--0--text').val();

        var nameOfSoc9=$('#control--runtime--964--0--text').val();
        var positionInSoc9=$('#control--runtime--965--0--text').val();

        var nameOfSoc10=$('#control--runtime--966--0--text').val();
        var positionInSoc10=$('#control--runtime--967--0--text').val();


        $("input[name='memberKey']").each(function(){
            if(updateFlag==1){
                if(updateKey == $(this).val()){

                }else{
                    if ($(this).val().toUpperCase() == memberkey.toUpperCase()) {
                        if(citizenship == 1 || citizenship == 2){
                            $("#control--runtime--906--0--errorMsg_right").text("Please enter a different NRIC.").show();
                            $("#control--runtime--906--0--errorMsg_right").attr("style","display: block;");
                        }else if (citizenship == 3) {
                            $("#control--runtime--940--0--errorMsg_right").text("Please enter a different FIN.").show();
                            $("#control--runtime--940--0--errorMsg_right").attr("style","display: block;");
                        }else if (citizenship == 4){
                            $("#control--runtime--907--0--errorMsg_right").text("Please enter a different Passport No.").show();
                            $("#control--runtime--907--0--errorMsg_right").attr("style","display: block;");
                        }
                        errorCount++;
                    } else {
                        var currentMemberkey = $(this).val();
                        var userId = $.trim(currentMemberkey.split("||")[1]);
                        if(userId != undefined && userId.length > 0){
                            if(citizenship == 1 || citizenship == 2){
                                if(userId.toUpperCase() == nric.toUpperCase()){
                                    $("#control--runtime--906--0--errorMsg_right").text("Please enter a different NRIC.").show();
                                    $("#control--runtime--906--0--errorMsg_right").attr("style","display: block;");
                                    errorcount++;
                                }
                            }else if (citizenship == 3) {
                                if(userId.toUpperCase() == fin.toUpperCase()){
                                    $("#control--runtime--940--0--errorMsg_right").text("Please enter a different FIN.").show();
                                    $("#control--runtime--940--0--errorMsg_right").attr("style","display: block;");
                                    errorcount++;
                                }
                            }else if (citizenship == 4){
                                if(userId.toUpperCase() == passport.toUpperCase()){
                                    $("#control--runtime--907--0--errorMsg_right").text("Please enter a different Passport No.").show();
                                    $("#control--runtime--907--0--errorMsg_right").attr("style","display: block;");
                                    errorcount++;
                                }
                            }
                        }
                    }
                }
            }else{
                if ($(this).val().toUpperCase() == memberkey.toUpperCase()) {
                    if(citizenship == 1 || citizenship == 2){
                        $("#control--runtime--906--0--errorMsg_right").text("Please enter a different NRIC.").show();
                        $("#control--runtime--906--0--errorMsg_right").attr("style","display: block;");
                    }else if (citizenship == 3) {
                        $("#control--runtime--940--0--errorMsg_right").text("Please enter a different FIN.").show();
                        $("#control--runtime--940--0--errorMsg_right").attr("style","display: block;");
                    }else if (citizenship == 4){
                        $("#control--runtime--907--0--errorMsg_right").text("Please enter a different Passport No.").show();
                        $("#control--runtime--907--0--errorMsg_right").attr("style","display: block;");
                    }
                    errorCount++;
                } else {
                    var currentMemberkey = $(this).val();
                    var userId = $.trim(currentMemberkey.split("||")[1]);
                    if(userId != undefined && userId.length > 0){
                        if(citizenship == 1 || citizenship == 2){
                            if(userId.toUpperCase() == nric.toUpperCase()){
                                $("#control--runtime--906--0--errorMsg_right").text("Please enter a different NRIC.").show();
                                $("#control--runtime--906--0--errorMsg_right").attr("style","display: block;");
                                errorcount++;
                            }
                        }else if (citizenship == 3) {
                            if(userId.toUpperCase() == fin.toUpperCase()){
                                $("#control--runtime--940--0--errorMsg_right").text("Please enter a different FIN.").show();
                                $("#control--runtime--940--0--errorMsg_right").attr("style","display: block;");
                                errorcount++;
                            }
                        }else if (citizenship == 4){
                            if(userId.toUpperCase() == passport.toUpperCase()){
                                $("#control--runtime--907--0--errorMsg_right").text("Please enter a different Passport No.").show();
                                $("#control--runtime--907--0--errorMsg_right").attr("style","display: block;");
                                errorcount++;
                            }
                        }
                    }
                }
            }
        });


        var key = "";
        if (titleOfBearers != '' && titleOfBearers != undefined) {
            key = titleOfBearers.split("|")[0];
        }
        $("input[name='equivalentPostHide']").each(function(){
            if(updateFlag==1){
                if(updatePosition == $(this).val()){

                }else{
                    if (key == 'President' || key == 'Secretary'  || key == 'Treasurer' ) {
                        if ($(this).val().trim() == key){
                            $("#control--runtime--10001--1--errorMsg").html("The Position has already been registered");
                            $("#control--runtime--10001--1--errorMsg").attr("style","display: block;");
                            errorCount++;
                        }
                    }
                }
            }else{
                if (key == 'President' || key == 'Secretary'  || key == 'Treasurer' ) {
                    if ($(this).val().trim() == key){
                        $("#control--runtime--10001--1--errorMsg").html("The Position has already been registered");
                        $("#control--runtime--10001--1--errorMsg").attr("style","display: block;");
                        errorCount++;
                    }
                }
            }


        });
        if (nameOfSoc1 != '' && positionInSoc1 == '') {
            $("#control--runtime--949--0--errorMsg_right").html("Please enter the Position in Society.");
            $("#control--runtime--949--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc1 == '' && positionInSoc1 != '') {
            $("#control--runtime--948--0--errorMsg_right").html("Please enter the Name of Society.");
            $("#control--runtime--948--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc2 != '' && positionInSoc2 == '') {
            $("#control--runtime--951--0--errorMsg_right").html("Please enter the Position in Society.");
            $("#control--runtime--951--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc2 == '' && positionInSoc2 != '') {
            $("#control--runtime--950--0--errorMsg_right").html("Please enter the Name of Society.");
            $("#control--runtime--950--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc3 != '' && positionInSoc3 == '') {
            $("#control--runtime--953--0--errorMsg_right").html("Please enter the Position in Society.");
            $("#control--runtime--953--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc3 == '' && positionInSoc3 != '') {
            $("#control--runtime--952--0--errorMsg_right").html("Please enter the Name of Society.");
            $("#control--runtime--952--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc4 != '' && positionInSoc4 == '') {
            $("#control--runtime--955--0--errorMsg_right").html("Please enter the Position in Society.");
            $("#control--runtime--955--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc4 == '' && positionInSoc4 != '') {
            $("#control--runtime--954--0--errorMsg_right").html("Please enter the Name of Society.");
            $("#control--runtime--954--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc5 != '' && positionInSoc5 == '') {
            $("#control--runtime--957--0--errorMsg_right").html("Please enter the Position in Society.");
            $("#control--runtime--957--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc5 == '' && positionInSoc5 != '') {
            $("#control--runtime--956--0--errorMsg_right").html("Please enter the Name of Society.");
            $("#control--runtime--956--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc6 == '' && positionInSoc6 != '') {
            $("#control--runtime--958--0--errorMsg_right").html("Please enter the Name of Society.");
            $("#control--runtime--958--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc6 != '' && positionInSoc6 == '') {
            $("#control--runtime--959--0--errorMsg_right").html("Please enter the Position in Society.");
            $("#control--runtime--959--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc7 == '' && positionInSoc7 != '') {
            $("#control--runtime--960--0--errorMsg_right").html("Please enter the Name of Society.");
            $("#control--runtime--960--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc7 != '' && positionInSoc7 == '') {
            $("#control--runtime--961--0--errorMsg_right").html("Please enter the Position in Society.");
            $("#control--runtime--961--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc8 == '' && positionInSoc8 != '') {
            $("#control--runtime--962--0--errorMsg_right").html("Please enter the Name of Society.");
            $("#control--runtime--962--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc8 != '' && positionInSoc8 == '') {
            $("#control--runtime--963--0--errorMsg_right").html("Please enter the Position in Society.");
            $("#control--runtime--963--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc9 == '' && positionInSoc9 != '') {
            $("#control--runtime--964--0--errorMsg_right").html("Please enter the Name of Society.");
            $("#control--runtime--964--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc9 != '' && positionInSoc9 == '') {
            $("#control--runtime--965--0--errorMsg_right").html("Please enter the Position in Society.");
            $("#control--runtime--965--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc10 == '' && positionInSoc10 != '') {
            $("#control--runtime--966--0--errorMsg_right").html("Please enter the Name of Society.");
            $("#control--runtime--966--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (nameOfSoc10 != '' && positionInSoc10 == '') {
            $("#control--runtime--967--0--errorMsg_right").html("Please enter the Position in Society.");
            $("#control--runtime--967--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }
        if (titleOfBearers == '' || titleOfBearers == undefined) {
            $("#control--runtime--296--0--errorMsg_right").html("Please enter the title of office-bearer.");
            $("#control--runtime--296--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }

        if (citizenship == '' || citizenship == undefined) {
            $("#control--runtime--304--0--errorMsg_right").html("Please select the citizenship.");
            $("#control--runtime--304--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }

        if (coutryBirth == '' || coutryBirth == undefined) {
            $("#control--runtime--3001--0--errorMsg_right").html("Please select the country of birth.");
            $("#control--runtime--3001--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }

        if (employmentStatus == '' || employmentStatus == undefined) {
            $("#control--runtime--916--0--errorMsg_right").html("Please select the option for present employment status.");
            $("#control--runtime--916--0--errorMsg_right").attr("style","display: block;");
            errorCount++;
        }else if(employmentStatus == '2' || employmentStatus == '3'){
            if (employerName == '' || employerName == undefined) {
                $("#control--runtime--918--0--errorMsg_right").html("Please enter the name of employer/company.");
                $("#control--runtime--918--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }
            if (jobTitle == '' || jobTitle == undefined) {
                $("#control--runtime--917--0--errorMsg_right").html("Please enter the position/job title.");
                $("#control--runtime--917--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }

            if (companyAddressOption == '' || companyAddressOption == undefined) {
                $("#control--runtime--919--0--errorMsg_right").html("Please select the option for address of company.");
                $("#control--runtime--919--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else if(companyAddressOption == 'Local Address'){
                if (companyPostalCode == '' || companyPostalCode == undefined) {
                    $("#control--runtime--925--0--errorMsg_right").html("Please enter a postal code.");
                    $("#control--runtime--925--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }else{
                    var errorMsg = validateMemberPostalCodeValue(companyPostalCode);
                    if(errorMsg!='' && errorMsg != undefined){
                        $("#control--runtime--925--0--errorMsg_right").html("Please enter a valid Postal Code.");
                        $("#control--runtime--925--0--errorMsg_right").attr("style","display: block;");
                        errorCount++;
                    }
                }
                if (companyHouseNo == '' || companyHouseNo == undefined) {
                    $("#control--runtime--921--0--errorMsg_right").html("Please select one.");
                    $("#control--runtime--921--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
                if (companyStreetName == '' || companyStreetName == undefined) {
                    $("#control--runtime--922--0--errorMsg_right").html("");
                    $("#control--runtime--922--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
                if (officeTel == '' || officeTel == undefined) {
                    $("#control--runtime--920--0--errorMsg_right").html("Please enter an office no.");
                    $("#control--runtime--920--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }else if (officeTel.length == 8 && !isNaN(officeTel)){
                    $("#control--runtime--920--0--errorMsg_right").hide();
                }else{
                    $("#control--runtime--920--0--errorMsg_right").text("Please enter a valid office no.").show();
                    $("#control--runtime--920--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }else if (companyAddressOption == 'Foreign Address'){
                if (companyAddress == '' || companyAddress == undefined) {
                    $("#control--runtime--926--0--errorMsg_right").html("Please enter the address.");
                    $("#control--runtime--926--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }
        }

        if (citizenship == '1' || citizenship=='2') {
            if (name == '' || name == undefined) {
                $("#control--runtime--298--0--errorMsg_right").html("Please enter the full name of proposed member.");
                $("#control--runtime--298--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }

            if (maritalStatus == '' || maritalStatus == undefined) {
                $("#control--runtime--308--0--errorMsg_right").html("Please select the marital status.");
                $("#control--runtime--308--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }
            if (emailAddress == '' || emailAddress == undefined) {
                $("#control--runtime--302--0--errorMsg_right").html("Please enter an email address.");
                $("#control--runtime--302--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else {

                if(!checkMail(emailAddress)){
                    $("#control--runtime--302--0--errorMsg_right").html("Please enter a valid email address.").show();
                    $("#control--runtime--302--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }else{
                    $("#control--runtime--302--0--errorMsg_right").hide();
                }
            }

            if (religion == '' || religion == undefined) {
                $("#control--runtime--309--0--errorMsg_right").html("Please select the religion.");
                $("#control--runtime--309--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            } else if(religion == 'Others'){
                if (otherReligion == '' || otherReligion == undefined) {
                    $("#control--runtime--3002--0--errorMsg_right").html("Please specify other religion.");
                    $("#control--runtime--3002--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }else if(!isAlphabet(otherReligion)){
                    $("#control--runtime--3002--0--errorMsg_right").html("Please enter a valid other religion.");
                    $("#control--runtime--3002--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }

            if (highestEducation == '' || highestEducation == undefined) {
                $("#control--runtime--941--0--errorMsg_right").html("Please select the highest education level.");
                $("#control--runtime--941--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }

            if (mobilePhone == '' || mobilePhone == undefined) {
                $("#control--runtime--301--0--errorMsg_right").html("Please enter a mobile no.");
                $("#control--runtime--301--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else {
                if (!isNum20(mobilePhone)) {
                    $("#control--runtime--301--0--errorMsg_right").html("Please enter a valid mobile no.");
                    $("#control--runtime--301--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }

            if (residentialTelephone == '' || residentialTelephone == undefined) {
                $("#control--runtime--300--0--errorMsg_right").html("Please enter a residential telephone no.");
                $("#control--runtime--300--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else{
                if (!isNum20(residentialTelephone)) {
                    $("#control--runtime--300--0--errorMsg_right").html("Please enter a valid residential telephone no.");
                    $("#control--runtime--300--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }

            if (nric == '' || nric == undefined) {
                $("#control--runtime--906--0--errorMsg_right").html("Please enter the NRIC.");
                $("#control--runtime--906--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            } else {
                var errorMsg = validateName(nric, "nric");
                if(errorMsg!=''){
                    $("#control--runtime--906--0--errorMsg_right").html(errorMsg);
                    $("#control--runtime--906--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }

            if (birthDate == '' || birthDate == undefined) {
                $("#control--runtime--303--0--errorMsg_right").html("Please enter the date of birth.");
                $("#control--runtime--303--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else{
                if(!isAfterCurrentDate(birthDate)){
                    $("#control--runtime--303--0--errorMsg_right").html("Please enter a valid date of birth.");
                    $("#control--runtime--303--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }

        }else if (citizenship == '3') {
            if (name == '' || name == undefined) {
                $("#control--runtime--298--0--errorMsg_right").html("Please enter the full name of proposed member.");
                $("#control--runtime--298--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }

            if (maritalStatus == '' || maritalStatus == undefined) {
                $("#control--runtime--308--0--errorMsg_right").html("Please select the marital status.");
                $("#control--runtime--308--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }
            if (emailAddress == '' || emailAddress == undefined) {
                $("#control--runtime--302--0--errorMsg_right").html("Please enter an email address.");
                $("#control--runtime--302--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else {

                if(!checkMail(emailAddress)){
                    $("#control--runtime--302--0--errorMsg_right").html("Please enter a valid email address.").show();
                    $("#control--runtime--302--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }else{
                    $("#control--runtime--302--0--errorMsg_right").hide();
                }
            }

            if (religion == '' || religion == undefined) {
                $("#control--runtime--309--0--errorMsg_right").html("Please select the religion.");
                $("#control--runtime--309--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            } else if(religion == 'Others'){
                if (otherReligion == '' || otherReligion == undefined) {
                    $("#control--runtime--3002--0--errorMsg_right").html("Please specify other religion.");
                    $("#control--runtime--3002--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }else if(!isAlphabet(otherReligion)){
                    $("#control--runtime--3002--0--errorMsg_right").html("Please enter a valid other religion.");
                    $("#control--runtime--3002--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }

            if (highestEducation == '' || highestEducation == undefined) {
                $("#control--runtime--941--0--errorMsg_right").html("Please select the highest education level.");
                $("#control--runtime--941--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }

            if (mobilePhone == '' || mobilePhone == undefined) {
                $("#control--runtime--301--0--errorMsg_right").html("Please enter a mobile no.");
                $("#control--runtime--301--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else {
                if (!isNum20(mobilePhone)) {
                    $("#control--runtime--301--0--errorMsg_right").html("Please enter a valid mobile no.");
                    $("#control--runtime--301--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }

            if (residentialTelephone == '' || residentialTelephone == undefined) {
                $("#control--runtime--300--0--errorMsg_right").html("Please enter a residential telephone no.");
                $("#control--runtime--300--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else{
                if (!isNum20(residentialTelephone)) {
                    $("#control--runtime--300--0--errorMsg_right").html("Please enter a valid residential telephone no.");
                    $("#control--runtime--300--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }

            if (fin == '' || fin == undefined) {
                $("#control--runtime--940--0--errorMsg_right").html("Please enter the FIN.");
                $("#control--runtime--940--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            } else {
                var errorMsg = validateName(fin, "fin");
                if(errorMsg!=''){
                    $("#control--runtime--940--0--errorMsg_right").html(errorMsg);
                    $("#control--runtime--940--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }

            if (passport == '' || passport == undefined) {
                $("#control--runtime--907--0--errorMsg_right").html("Please enter the passport no.");
                $("#control--runtime--907--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }

            if (nationality == '' || nationality == undefined) {
                $("#control--runtime--935--0--errorMsg_right").html("Please select the nationality.");
                $("#control--runtime--935--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }

            if (residentialAddress == '' || residentialAddress == undefined) {
                $("#control--runtime--299--0--errorMsg_right").html("Please select the option for residential address.");
                $("#control--runtime--299--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else if(residentialAddress == 'Local Address'){
                if (postalCode == '' || postalCode == undefined) {
                    $("#control--runtime--909--0--errorMsg_right").html("Please enter a postal code.");
                    $("#control--runtime--909--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }

                if (addressNo == '' || addressNo == undefined) {
                    $("#control--runtime--910--0--errorMsg_right").html("Please select one.");
                    $("#control--runtime--910--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }

                if (streetName == '' || streetName == undefined) {
                    $("#control--runtime--912--0--errorMsg_right").html("Please enter the address name.");
                    $("#control--runtime--912--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }

                if (addressNo == '' || addressNo == undefined) {
                    $("#control--runtime--910--0--errorMsg_right").html("Please select one.");
                    $("#control--runtime--910--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }else if(residentialAddress == 'Foreign Address'){
                if (address == '' || address == undefined) {
                    $("#control--runtime--913--0--errorMsg_right").html("Please enter the address.");
                    $("#control--runtime--913--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }

            if (race == '' || race == undefined) {
                $("#control--runtime--306--0--errorMsg_right").html("Please select the race.");
                $("#control--runtime--306--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else if (race == 'Others') {
                if (otherRace == '' || otherRace == undefined) {
                    $("#control--runtime--307--0--errorMsg_right").html("Please specify the race.");
                    $("#control--runtime--307--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }else if(!isAlphabet(otherRace)){
                    $("#control--runtime--307--0--errorMsg_right").html("Please enter a valid other race.");
                    $("#control--runtime--307--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }

            if (gender == '' || gender == undefined) {
                $("#control--runtime--305--0--errorMsg_right").html("Please select the options for gender.");
                $("#control--runtime--305--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }

            if (birthDate == '' || birthDate == undefined) {
                $("#control--runtime--303--0--errorMsg_right").html("Please enter the date of birth.");
                $("#control--runtime--303--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else{
                if(!isAfterCurrentDate(birthDate)){
                    $("#control--runtime--303--0--errorMsg_right").html("Please enter a valid date of birth.");
                    $("#control--runtime--303--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }
        }else if (citizenship == '4') {
            if (name == '' || name == undefined) {
                $("#control--runtime--298--0--errorMsg_right").html("Please enter the full name of proposed member.");
                $("#control--runtime--298--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }

            if (maritalStatus == '' || maritalStatus == undefined) {
                $("#control--runtime--308--0--errorMsg_right").html("Please select the marital status.");
                $("#control--runtime--308--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }
            if (emailAddress == '' || emailAddress == undefined) {
                $("#control--runtime--302--0--errorMsg_right").html("Please enter an email address.");
                $("#control--runtime--302--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else {

                if(!checkMail(emailAddress)){
                    $("#control--runtime--302--0--errorMsg_right").html("Please enter a valid email address.").show();
                    $("#control--runtime--302--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }else{
                    $("#control--runtime--302--0--errorMsg_right").hide();
                }
            }

            if (religion == '' || religion == undefined) {
                $("#control--runtime--309--0--errorMsg_right").html("Please select the religion.");
                $("#control--runtime--309--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            } else if(religion == 'Others'){
                if (otherReligion == '' || otherReligion == undefined) {
                    $("#control--runtime--3002--0--errorMsg_right").html("Please specify other religion.");
                    $("#control--runtime--3002--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }else if(!isAlphabet(otherReligion)){
                    $("#control--runtime--3002--0--errorMsg_right").html("Please enter a valid other religion.");
                    $("#control--runtime--3002--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }

            if (highestEducation == '' || highestEducation == undefined) {
                $("#control--runtime--941--0--errorMsg_right").html("Please select the highest education level.");
                $("#control--runtime--941--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }

            if (mobilePhone == '' || mobilePhone == undefined) {
                $("#control--runtime--301--0--errorMsg_right").html("Please enter a mobile no.");
                $("#control--runtime--301--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else {
                if (!isNum20(mobilePhone)) {
                    $("#control--runtime--301--0--errorMsg_right").html("Please enter a valid mobile no.");
                    $("#control--runtime--301--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }

            if (residentialTelephone == '' || residentialTelephone == undefined) {
                $("#control--runtime--300--0--errorMsg_right").html("Please enter a residential telephone no.");
                $("#control--runtime--300--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else{
                if (!isNum20(residentialTelephone)) {
                    $("#control--runtime--300--0--errorMsg_right").html("Please enter a valid residential telephone no.");
                    $("#control--runtime--300--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }

            if (passport == '' || passport == undefined) {
                $("#control--runtime--907--0--errorMsg_right").html("Please enter the passport no.");
                $("#control--runtime--907--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else{
                var errorMsg = validateName(passport, "passport");
                if(errorMsg!=''){
                    $("#control--runtime--907--0--errorMsg_right").html(errorMsg);
                    $("#control--runtime--907--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }

            if (nationality == '' || nationality == undefined) {
                $("#control--runtime--935--0--errorMsg_right").html("Please select the nationality.");
                $("#control--runtime--935--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }

            if (residentialAddress == '' || residentialAddress == undefined) {
                $("#control--runtime--299--0--errorMsg_right").html("Please select the option for residential address.");
                $("#control--runtime--299--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else if(residentialAddress == 'Local Address'){
                if (postalCode == '' || postalCode == undefined) {
                    $("#control--runtime--909--0--errorMsg_right").html("Please enter a postal code.");
                    $("#control--runtime--909--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }else{
                    var errorMsg = validateMemberPostalCode(postalCode);
                    if(errorMsg!='' && errorMsg != undefined){
                        $("#control--runtime--909--0--errorMsg_right").html("Please enter a valid Postal Code.");
                        $("#control--runtime--909--0--errorMsg_right").attr("style","display: block;");
                        errorCount++;
                    }
                }

                if (addressNo == '' || addressNo == undefined) {
                    $("#control--runtime--910--0--errorMsg_right").html("Please select one.");
                    $("#control--runtime--910--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }

                if (streetName == '' || streetName == undefined) {
                    $("#control--runtime--912--0--errorMsg_right").html("Please enter the street name.");
                    $("#control--runtime--912--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }else if(residentialAddress == 'Foreign Address'){
                if (address == '' || address == undefined) {
                    $("#control--runtime--913--0--errorMsg_right").html("Please enter the address.");
                    $("#control--runtime--913--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }

            if (gender == '' || gender == undefined) {
                $("#control--runtime--305--0--errorMsg_right").html("Please select the options for gender.");
                $("#control--runtime--305--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }

            if (race == '' || race == undefined) {
                $("#control--runtime--306--0--errorMsg_right").html("Please select the race.");
                $("#control--runtime--306--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else if (race == 'Others') {
                if (otherRace == '' || otherRace == undefined) {
                    $("#control--runtime--307--0--errorMsg_right").html("Please specify the race.");
                    $("#control--runtime--307--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }else if(!isAlphabet(otherRace)){
                    $("#control--runtime--307--0--errorMsg_right").html("Please enter a valid other race.");
                    $("#control--runtime--307--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }
            if (birthDate == '' || birthDate == undefined) {
                $("#control--runtime--303--0--errorMsg_right").html("Please enter the date of birth.");
                $("#control--runtime--303--0--errorMsg_right").attr("style","display: block;");
                errorCount++;
            }else{
                if(!isAfterCurrentDate(birthDate)){
                    $("#control--runtime--303--0--errorMsg_right").html("Please enter a valid date of birth.");
                    $("#control--runtime--303--0--errorMsg_right").attr("style","display: block;");
                    errorCount++;
                }
            }
        }
        restWindowHight();
        return errorCount;
    }

    $("#control--runtime--909--0--text").blur(function(){
        var postalCode =  $("#control--runtime--909--0--text").val();
        if(postalCode == "" || postalCode == null){

        }else{
            var errorMsg = validateMemberPostalCode(postalCode);
            if(errorMsg!='' && errorMsg != undefined){
                $("#control--runtime--909--0--errorMsg_right").html("Please enter a valid Postal Code.");
                $("#control--runtime--909--0--errorMsg_right").attr("style","display: block;");
            }else{
                $("#control--runtime--909--0--errorMsg_right").hide();
            }
        }
    });

    $("#control--runtime--925--0--text").blur(function(){
        var postalCode =  $("#control--runtime--925--0--text").val();
        if(postalCode == "" || postalCode == null){
            $("#control--runtime--925--errorMsg_right").text("Please enter a valid Postal Code.").show();
        }else{
            var errorMsg = validateMemberPostalCodeValue(postalCode);
            if(errorMsg!='' && errorMsg != undefined){
                $("#control--runtime--925--0--errorMsg_right").html("Please enter a valid Postal Code.");
                $("#control--runtime--925--0--errorMsg_right").attr("style","display: block;");
            }else{
                $("#control--runtime--925--0--errorMsg_right").hide();
            }
        }
    });
    function validateName(value, valueType){
        var titleOfBearers = $('#control--runtime--296--0--select option:selected').val();
        var equivalentPost = "";
        if (titleOfBearers != '' && titleOfBearers != undefined) {
            equivalentPost = titleOfBearers.split("|")[0];
        }
        var errorMessage = "";
        $.ajax({
            url: '/egp/iroses/common/ajax.jsp?handler=sg.gov.mha.iroses.registryofsociety.action.RegistryOfSocietyAjax.validateUin',
            type: 'POST',
            async: false,
            data: {
                value : value,
                valueType : valueType,
                equivalentPost : equivalentPost
            },
            dataType: 'JSON',
            success: function(data) {
                if(data != null && data != ""){
                    if(data.errorMessage != null && data.errorMessage != ""){
                        errorMessage = data.errorMessage;
                    }
                }
            }
        });
        return errorMessage;

    }

    function validateMemberPostalCode(value){
        var errorMsg;
        $.ajax({
            url: '/egp/iroses/common/ajax.jsp?handler=sg.gov.mha.iroses.registryofsociety.action.RegistryOfSocietyAjax.retrievePostalCodeMessage',
            type: 'POST',
            async: false,
            data: {
                postalCode : value
            },
            dataType: 'JSON',
            success: function(data) {
                if(data.errorMessage != null && data.errorMessage != ""){
                    errorMsg = data.errorMessage;
                }else{
                    var selectValue=$("#control--runtime--910--0--select").val();
                    var blkHouseNos = data.blkHouseNos;
                    var index = $.inArray(selectValue,blkHouseNos);
                    if(index < 0){
                        $("#control--runtime--910--0--select").empty();
                        $("#control--runtime--910--0--select").append( "<option value=\"\">-Please Select-</option>" );
                        for(var i=0;i<blkHouseNos.length;i++){
                            $("#control--runtime--910--0--select").append( "<option value=\""+blkHouseNos[i]+"\">"+blkHouseNos[i]+"</option>" )
                        }
                        $("#control--runtime--908--0--text").val(data.buildingName);
                    }
                    $("#control--runtime--912--0--text").val(data.streetName);
                }
            }
        });
        return errorMsg;
    }

    function validateMemberPostalCodeValue(value){
        var errorMsg;
        $.ajax({
            url: '/egp/iroses/common/ajax.jsp?handler=sg.gov.mha.iroses.registryofsociety.action.RegistryOfSocietyAjax.retrievePostalCodeMessage',
            type: 'POST',
            async: false,
            data: {
                postalCode : value
            },
            dataType: 'JSON',
            success: function(data) {
                if(data.errorMessage != null && data.errorMessage != ""){
                    errorMsg = data.errorMessage;
                }else{
                    var selectValue=$("#control--runtime--921--0--select").val();
                    var blkHouseNos = data.blkHouseNos;
                    var index = $.inArray(selectValue,blkHouseNos);
                    if(index < 0){
                        $("#control--runtime--921--0--select").empty();
                        $("#control--runtime--921--0--select").append( "<option value=\"\">-Please Select-</option>" );
                        for(var i=0;i<blkHouseNos.length;i++){
                            $("#control--runtime--921--0--select").append( "<option value=\""+blkHouseNos[i]+"\">"+blkHouseNos[i]+"</option>" )
                        }
                        $("#control--runtime--923--0--text").val(data.buildingName);
                    }
                    $("#control--runtime--922--0--text").val(data.streetName);
                }
            }
        });
        return errorMsg;
    }
</script>
<script type="text/javascript">
    $("#control--runtime--906--0--text").keyup(function(){checkMaxLength(this, 9);});
    $("#control--runtime--906--0--text").blur(function(){checkMaxLength(this, 9);});
    $("#control--runtime--298--0--text").keyup(function(){checkMaxLength(this, 100);});
    $("#control--runtime--298--0--text").blur(function(){checkMaxLength(this, 100);});
    $("#control--runtime--302--0--text").keyup(function(){checkMaxLength(this, 100);});
    $("#control--runtime--302--0--text").blur(function(){checkMaxLength(this, 100);});
    $("#control--runtime--3002--0--text").keyup(function(){checkMaxLength(this, 20);});
    $("#control--runtime--3002--0--text").blur(function(){checkMaxLength(this, 20);});
    $("#control--runtime--300--0--text").keyup(function(){checkMaxLength(this, 20);});
    $("#control--runtime--300--0--text").blur(function(){checkMaxLength(this, 20);});
    $("#control--runtime--301--0--text").keyup(function(){checkMaxLength(this, 20);});
    $("#control--runtime--301--0--text").blur(function(){checkMaxLength(this, 20);});
    $("#control--runtime--917--0--text").keyup(function(){checkMaxLength(this, 150);});
    $("#control--runtime--917--0--text").blur(function(){checkMaxLength(this, 150);});
    $("#control--runtime--925--0--text").keyup(function(){checkMaxLength(this, 6);});
    $("#control--runtime--925--0--text").blur(function(){checkMaxLength(this, 6);});
    $("#control--runtime--918--0--text").keyup(function(){checkMaxLength(this, 150);});
    $("#control--runtime--918--0--text").blur(function(){checkMaxLength(this, 150);});
    $("#control--runtime--943--0--text").keyup(function(){checkMaxLength(this, 3);});
    $("#control--runtime--943--0--text").blur(function(){checkMaxLength(this, 3);});
    $("#control--runtime--924--0--text").keyup(function(){checkMaxLength(this, 5);});
    $("#control--runtime--924--0--text").blur(function(){checkMaxLength(this, 5);});
    $("#control--runtime--923--0--text").keyup(function(){checkMaxLength(this, 100);});
    $("#control--runtime--923--0--text").blur(function(){checkMaxLength(this, 100);});
    $("#control--runtime--920--0--text").keyup(function(){checkMaxLength(this, 8);});
    $("#control--runtime--920--0--text").blur(function(){checkMaxLength(this, 8);});
    $("#control--runtime--949--0--text").keyup(function(){checkMaxLength(this, 150);});
    $("#control--runtime--949--0--text").blur(function(){checkMaxLength(this, 150);});
    $("#control--runtime--951--0--text").keyup(function(){checkMaxLength(this, 150);});
    $("#control--runtime--951--0--text").blur(function(){checkMaxLength(this, 150);});
    $("#control--runtime--953--0--text").keyup(function(){checkMaxLength(this, 150);});
    $("#control--runtime--953--0--text").blur(function(){checkMaxLength(this, 150);});
    $("#control--runtime--955--0--text").keyup(function(){checkMaxLength(this, 150);});
    $("#control--runtime--955--0--text").blur(function(){checkMaxLength(this, 150);});
    $("#control--runtime--957--0--text").keyup(function(){checkMaxLength(this, 150);});
    $("#control--runtime--957--0--text").blur(function(){checkMaxLength(this, 150);});
    $("#control--runtime--959--0--text").keyup(function(){checkMaxLength(this, 150);});
    $("#control--runtime--959--0--text").blur(function(){checkMaxLength(this, 150);});
    $("#control--runtime--961--0--text").keyup(function(){checkMaxLength(this, 150);});
    $("#control--runtime--961--0--text").blur(function(){checkMaxLength(this, 150);});
    $("#control--runtime--963--0--text").keyup(function(){checkMaxLength(this, 150);});
    $("#control--runtime--963--0--text").blur(function(){checkMaxLength(this, 150);});
    $("#control--runtime--965--0--text").keyup(function(){checkMaxLength(this, 150);});
    $("#control--runtime--965--0--text").blur(function(){checkMaxLength(this, 150);});
    $("#control--runtime--967--0--text").keyup(function(){checkMaxLength(this, 150);});
    $("#control--runtime--967--0--text").blur(function(){checkMaxLength(this, 150);});
    $("#control--runtime--948--0--text").keyup(function(){checkMaxLength(this, 300);});
    $("#control--runtime--948--0--text").blur(function(){checkMaxLength(this, 300);});
    $("#control--runtime--950--0--text").keyup(function(){checkMaxLength(this, 300);});
    $("#control--runtime--950--0--text").blur(function(){checkMaxLength(this, 300);});
    $("#control--runtime--952--0--text").keyup(function(){checkMaxLength(this, 300);});
    $("#control--runtime--952--0--text").blur(function(){checkMaxLength(this, 300);});
    $("#control--runtime--954--0--text").keyup(function(){checkMaxLength(this, 300);});
    $("#control--runtime--954--0--text").blur(function(){checkMaxLength(this, 300);});
    $("#control--runtime--956--0--text").keyup(function(){checkMaxLength(this, 300);});
    $("#control--runtime--956--0--text").blur(function(){checkMaxLength(this, 300);});
    $("#control--runtime--958--0--text").keyup(function(){checkMaxLength(this, 300);});
    $("#control--runtime--958--0--text").blur(function(){checkMaxLength(this, 300);});
    $("#control--runtime--960--0--text").keyup(function(){checkMaxLength(this, 300);});
    $("#control--runtime--960--0--text").blur(function(){checkMaxLength(this, 300);});
    $("#control--runtime--962--0--text").keyup(function(){checkMaxLength(this, 300);});
    $("#control--runtime--962--0--text").blur(function(){checkMaxLength(this, 300);});
    $("#control--runtime--964--0--text").keyup(function(){checkMaxLength(this, 300);});
    $("#control--runtime--964--0--text").blur(function(){checkMaxLength(this, 300);});
    $("#control--runtime--966--0--text").keyup(function(){checkMaxLength(this, 300);});
    $("#control--runtime--966--0--text").blur(function(){checkMaxLength(this, 300);});
    $("#control--runtime--210--text").keyup(function(){checkGrossIn(this);});
    $("#control--runtime--210--text").blur(function(){checkGrossIn(this);});
    $("#control--runtime--211--text").keyup(function(){checkGrossIn(this);});
    $("#control--runtime--211--text").blur(function(){checkGrossIn(this);});
    function checkMaxLength(obj, max) {
        if(max > 0){
            var value = $(obj).val();
            var valueLength = $(obj).val().length;
            if (value && value.indexOf("\n") > -1) {
                valueLength += value.split('\n').length - 1;
            }
            if(valueLength > max){
                var targetVal = value.substr(0, max);
                if (value && value.indexOf("\n") > -1) {
                    targetVal = value.replaceAll("\n", "\r\n").substr(0, max).replaceAll("\r\n", "\n");
                }
                $(obj).val(targetVal);
            }
        }
    }
    function checkGrossIn(obj) {
        var value = $(obj).val();
        var values = value.split(".");
        if (value != '') {
            if (values.length==2) {
                v1 = values[0];
                if(v1.length>=9){
                    v1 = v1.substr(0, 9);
                }
                v2 = values[1];
                if(v2.length>=2){
                    v2 = v2.substr(0, 2);
                }
                var value = v1+"."+v2;
                $(obj).val(value);
            }else if(values.length==1){
                v1 = values[0];
                if(v1.length>=9){
                    v1 = v1.substr(0, 9);
                }
                $(obj).val(v1);
            }else if(values.length>=3){
                $(obj).val(values[0]+"."+values[1]);
            }
        }
    }
</script>